Raise any response object in Django
Project description
django-raise-response
django-raise-response is a simple plugin that provides the ability to return any response by raising it as you would do with django.http.Http404
Why would you need this? If you need to return a non-4XX/5XX response from a class-based view, for example a 303/301 response, this is the only decent way to do it.
Installing
pip install django-raise-response
Then add ‘raiseresponse.middlewares.RaiseResponse’ to your middlewares:
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'raiseresponse.middlewares.RaiseResponse'
]
Usage
Now you can use ResponseError to raise any response:
from raiseresponse import ResponseError # somewhere in your view response_you_want_to_rise = HttpResponse() raise ResponseError(response_you_want_to_rise)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-raise-response-0.1.0.tar.gz.
File metadata
- Download URL: django-raise-response-0.1.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1baec9c9b3537dd4e185ce4703e3f2f4c679d2d97e95be925ac604197a21c5d
|
|
| MD5 |
6643a300c01a07ecd0ea576cf16a169a
|
|
| BLAKE2b-256 |
18af03f49e09f4037a223a96e5d8057b6e6809df3e81dd819568209feae19f6c
|
File details
Details for the file django_raise_response-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_raise_response-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b640557bf394b86df9dca386a7018f16f1ef1e6622f588aa548c5006c04af82
|
|
| MD5 |
6e6e7af80c32e43324c6ac8bde741b8f
|
|
| BLAKE2b-256 |
4e139ba06e3bc46a9728436eb34c2033398441533d43955d36735a8700d6bba1
|