Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 5 months ago by OrbitalGuide543

Why does Django use the 'status' parameter instead of 'status_code' for HttpResponse?

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

Hello everyone!

I noticed a discrepancy in Django: the documentation references the attribute status_code for HttpResponse, but when building a response, you must use the parameter 'status'.

For example, the following code doesn't work:

PYTHON
# this doesn't work def click(request): return HttpResponse("Here's the text of the web page.", status_code = 404)

However, this version works as expected:

PYTHON
# But this works! def click(request): return HttpResponse("Here's the text of the web page.", status = 404)

Since the constructor in the source code (see here) accepts 'status', why does the documentation refer to 'status_code'? Any clarification would be appreciated.

0

Comments 0

Answers 0

Views 30

0 Answers

Discussion

No comments yet.