Django's `HttpResponse` class checks for the `status` param when it's initialized, if it's `None` it uses the class attribute `status_code` and thanks to that we can do things like: ``` class BadRequest(HttpResponse): status_code = 400 ``` Now, that doesn't work when inheriting from rest-framework's `Response`: ``` class BadRequest(rest_framework.response.Response): status_code = 400 # Bad, it's always ignored ``` Because a default status of `200` is being specified in `rest_framework.response.Response`. I think is more Django-friendly to just leave that status default value to `None` and leave the responsibility of choosing its value to the parent class: `HttpResponse`.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
authtoken | Loading commit data... | |
runtests | Loading commit data... | |
static/rest_framework | Loading commit data... | |
templates/rest_framework | Loading commit data... | |
templatetags | Loading commit data... | |
tests | Loading commit data... | |
utils | Loading commit data... | |
__init__.py | Loading commit data... | |
authentication.py | Loading commit data... | |
compat.py | Loading commit data... | |
decorators.py | Loading commit data... | |
exceptions.py | Loading commit data... | |
fields.py | Loading commit data... | |
filters.py | Loading commit data... | |
generics.py | Loading commit data... | |
mixins.py | Loading commit data... | |
models.py | Loading commit data... | |
negotiation.py | Loading commit data... | |
pagination.py | Loading commit data... | |
parsers.py | Loading commit data... | |
permissions.py | Loading commit data... | |
relations.py | Loading commit data... | |
renderers.py | Loading commit data... | |
request.py | Loading commit data... | |
response.py | Loading commit data... | |
reverse.py | Loading commit data... | |
routers.py | Loading commit data... | |
serializers.py | Loading commit data... | |
settings.py | Loading commit data... | |
six.py | Loading commit data... | |
status.py | Loading commit data... | |
test.py | Loading commit data... | |
throttling.py | Loading commit data... | |
urlpatterns.py | Loading commit data... | |
urls.py | Loading commit data... | |
views.py | Loading commit data... | |
viewsets.py | Loading commit data... |