Skip to main content

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]
}
})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-json-response-1.0.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

django_json_response-1.0.0-py2.7.egg (3.8 kB view details)

Uploaded Source

File details

Details for the file django-json-response-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django-json-response-1.0.0.tar.gz
Algorithm Hash digest
SHA256 81f633c35efbbee568f39366049cc75381021fdd9488bec38dbc64609325cf44
MD5 f69881b68803768a9e405889fdb44ba3
BLAKE2b-256 717230b985172b75bad8f5ee8adaef28d48e7314e793901fb487406271a1ffa9

See more details on using hashes here.

File details

Details for the file django_json_response-1.0.0-py2.7.egg.

File metadata

File hashes

Hashes for django_json_response-1.0.0-py2.7.egg
Algorithm Hash digest
SHA256 0e5e968dabcd45e10465172a2a6193b68ad82130b04cac6fa20c7d374bca9054
MD5 e994a4d994b2027b620ee956030a9ae1
BLAKE2b-256 78f653d4bac6c1e058e60ce4b913030009866b227840d4dd9ee22f04f51aa89b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page