Django Dict Response
Project description
Overview
Write views.py simply.
Usage
Before:
from django.shortcuts import redirect, render
def view(request):
...
if request.method == 'POST':
...
return redirect(url)
response = render(request, template_name, dict(obj=obj, title=title), status=200)
response['Age'] = 120
return response
After:
def view(request):
...
if request.method == 'POST':
...
return {'redirect_to': [url]}
return dict(Age=120, obj=obj, template_name=template_name, title=title, status=200)
Installation
Install using pip:
pip install -U django-dict-response
Add to last of MIDDLEWARE_CLASSES in your settings.py:
'django_dict_response.middlewares.DictResponseMiddleware',
Dependencies
Django >= 1.7
Configuration
REDIRECT_KEY
The setting is used when redirectdefault: 'redirect_to'
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
File details
Details for the file django-dict-response-0.0.8.tar.gz.
File metadata
- Download URL: django-dict-response-0.0.8.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd5a502465b7ef9f0d4a51923b6f4a3863e1798ea90e00399f616a48159563bf
|
|
| MD5 |
8fa048cbfd2d9711f526aa999de105ab
|
|
| BLAKE2b-256 |
e5074b945ff44e321c3e82e7158aff606b3b0d0f4caf29affcfe28e615c4b104
|