python 2.7 - How to return HTTP 400 response in Django? -


If I receive the request received data is invalid and can not be parsed then I will return an HTTP 400 response from my DjangoView function Want to do

How can I do this? It does not seem that the corresponding exception class is for 404:

  raise http404  

< Div class = "post-text" itemprop = "text">

From my previous comment:

You can also return

, you have an exception sub-class Http404 can make your own HTML 400 exception.

Regards,


Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -