Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Simple JSONP support for django

Project description

Simple JSONP support for django

Coverage Status Build Status PyPI version Scrutinizer Code Quality Code Health


Install using pip

$ pip install django-jsonp


from djsonp import jsonp, JSONPResponse, get_callback

# decorate something that returns a dict-like object
def my_view(request):
    return {'foo': 'bar'}

# it can work with an HttpResponse instances
def another_view(request):
    return HttpResponse("{'foo': 'bar'}")

# or just return a JSONPResponse
def jsonp_view(request):
    return JSONPResponse(data={'foo': 'bar', }, callback=get_callback(request))

# it also works for CBVs
from django.views.generic import View

class DictResponse(View):
    def get(self, request):
        return HttpResponse("{'foo': 'bar'}")

Project details

Download files

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

Files for django_jsonp, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size django_jsonp-0.3.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page