Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django error handling < form >

GITHUB URL: https://stackoverflow.com/questions/38847441/django-exception-handling-best-practice-and-sending-customized-error-message
  
form = TestForm(request.POST)
if form.is_valid():
    ...
else:
    message = "The form has errors"
    explanation = form.errors.as_data()
    # Also incorrect request but this time the only flag for you should be that maybe JavaScript validation can be used.
    status_code = 400
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #error #handling #form
ADD COMMENT
Topic
Name
3+1 =