DIY Django's JsonResponse and JsonpResponse
Project description
======================
django-json-response
======================
django-json-response
======================
class JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, **kwargs) 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 JsonHttpResponse({
'status': 200,
'message': u'成功'
'data': {
'data1': 'xxx',
'data2': 'ooo',
'objs': [obj.data for obj in objs]
}
})
django-json-response
======================
django-json-response
======================
class JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, **kwargs) 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 JsonHttpResponse({
'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
Close
Hashes for django-json-response-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f633c35efbbee568f39366049cc75381021fdd9488bec38dbc64609325cf44 |
|
MD5 | f69881b68803768a9e405889fdb44ba3 |
|
BLAKE2b-256 | 717230b985172b75bad8f5ee8adaef28d48e7314e793901fb487406271a1ffa9 |
Close
Hashes for django_json_response-1.0.0-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e5e968dabcd45e10465172a2a6193b68ad82130b04cac6fa20c7d374bca9054 |
|
MD5 | e994a4d994b2027b620ee956030a9ae1 |
|
BLAKE2b-256 | 78f653d4bac6c1e058e60ce4b913030009866b227840d4dd9ee22f04f51aa89b |