Skip to main content

django-json-response

Installation

pip install django-json-response

Warning

Since Version 1.1.3, the JsonpResponse return Object replace of String.

"{}('{}')" ==> '{}({});'

Usage

from json_response import JsonResponse

def json_view(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 jsonp_view(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]
        }
    })

or

from json_response import json_response, jsonp_response, auto_response

@json_response
def json_view(request):
    objs = SomeModel.objects.all()

    return {
        'status': 200,
        'message': u'成功',
        'data': {
            'data1': 'xxx',
            'data2': 'ooo',
            'objs': [obj.data for obj in objs]
        }
    }

@jsonp_response
def jsonp_view(request):
    objs = SomeModel.objects.all()

    return {
        'status': 200,
        'message': u'成功',
        'data': {
            'data1': 'xxx',
            'data2': 'ooo',
            'objs': [obj.data for obj in objs]
        }
    }

@auto_response
def jsonp_view(request):
    objs = SomeModel.objects.all()

    return {
        'status': 200,
        'message': u'成功',
        'data': {
            'data1': 'xxx',
            'data2': 'ooo',
            'objs': [obj.data for obj in objs]
        }
    }

Metadata

Release files for django-json-response 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-json-response 1.1.5
File Size Uploaded Provenance Actions
django-json-response-1.1.5.tar.gz 2.7 kB Without provenance Details for django-json-response-1.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-json-response 1.1.5
File Interpreter ABI Platform Actions
django_json_response-1.1.5-py2-none-any.whl Python 2 none any Details for django_json_response-1.1.5-py2-none-any.whl

Total release size: 7.2 kB

Release files / django-json-response-1.1.5.tar.gz

Download URL django-json-response-1.1.5.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f00a65c4981be3a1194668b69abc622a62dfc274f3db9f309c3f63d61cc7694f
BLAKE2b-256 checksum
How to use checksums
8a43809d6bf3cd5198f200b95206e00e226a1864dc32d64d0229396082ae4bc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_json_response-1.1.5-py2-none-any.whl

Download URL django_json_response-1.1.5-py2-none-any.whl
Size 4.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
bb84d90d9a06585abc73ec73c077ee0a1f6c2938334309931dd5a65b0fc47383
BLAKE2b-256 checksum
How to use checksums
629fc2a6c2ba7f42ec1255248cb05f6aa4ac53f51ed9835f5ab35f538b8f6f46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-json-response 1.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page