How can I return HTTP status code 204 from a Django view

0 votes
I want to return status code 204 No Content from a Django view. It is in response to an automatic POST which updates a database and I just need to indicate the update was successful (without redirecting the client).

There are subclasses of HttpResponse to handle most other codes but not 204.

What is the simplest way to do this?
Aug 17, 2020 in Python by kartik
• 37,520 points
11,008 views

1 answer to this question.

0 votes

Hello,

Try this:

return HttpResponse(status=204)

Hope it works!!

Thank you!

answered Aug 17, 2020 by Niroj
• 82,800 points
It's work well...Thank you
thank you,it's workes

Related Questions In Python

0 votes
1 answer