| Name |
Last commit
|
Last update |
|---|---|---|
| docs | ||
| rest_framework | ||
| .gitignore | ||
| .travis.yml | ||
| CONTRIBUTING.md | ||
| MANIFEST.in | ||
| README.md | ||
| mkdocs.py | ||
| optionals.txt | ||
| requirements.txt | ||
| setup.cfg | ||
| setup.py | ||
| tox.ini |
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 |
|---|---|---|
| docs | Loading commit data... | |
| rest_framework | Loading commit data... | |
| .gitignore | Loading commit data... | |
| .travis.yml | Loading commit data... | |
| CONTRIBUTING.md | Loading commit data... | |
| MANIFEST.in | Loading commit data... | |
| README.md | Loading commit data... | |
| mkdocs.py | Loading commit data... | |
| optionals.txt | Loading commit data... | |
| requirements.txt | Loading commit data... | |
| setup.cfg | Loading commit data... | |
| setup.py | Loading commit data... | |
| tox.ini | Loading commit data... |