DIY Django's JsonResponse and JsonpResponse
Project description
django-json-response
JsonResponse is New in Django 1.7
Ref: https://docs.djangoproject.com/en/1.8/ref/request-response/#jsonresponse-objects
Installation
pip install django-json-response
Usage
from json_response import JsonResponse def excelview(request): objs = SomeModel.objects.all() return JsonResponse({ 'status': 200, 'message': u'成功' 'data': { 'data1': 'xxx', 'data2': 'ooo', 'objs': [obj.data for obj in objs] } }) or from json_response import JsonpResponse def excelview(request): callback = request.GET.get('callback', '') objs = SomeModel.objects.all() return JsonpResponse(callback, { 'status': 200, 'message': u'成功' 'data': { 'data1': 'xxx', 'data2': 'ooo', 'objs': [obj.data for obj in objs] } })
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
File details
Details for the file django-json-response-1.0.7.tar.gz
.
File metadata
- Download URL: django-json-response-1.0.7.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aab660b3d5a20eabbd2afce81a8b1446eb1ed76f190c5f5d419909aee8eaef06 |
|
MD5 | dfc7f95b251a9b62194983015efb40b7 |
|
BLAKE2b-256 | b8fab87b97a21f1976e6c2ca6de6137935f67be3b2c8c447b3f400c0e74e055f |
File details
Details for the file django_json_response-1.0.7-py2.7.egg
.
File metadata
- Download URL: django_json_response-1.0.7-py2.7.egg
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d3eca56f63bba9f05be2d17c6ac89cb0c6c19f4cf6d8e678d16ebbf4e3beb7e |
|
MD5 | 304e0abee9d56bc4dd7da1808d47aa7c |
|
BLAKE2b-256 | f8ef1f7dcb9d9fd9843ae237dc6ad51c5e49b7147f2c36aaa5e2a00b9e237f9d |