semvec/pypi-packages huggingface dataset:
django_jsonp 0.3.0
Simple JSONP support for django
License: MIT

django-jsonp
============

Simple JSONP support for django

|Coverage Status| |Build Status| |PyPI version| |Scrutinizer Code
Quality| |Code Health| 

Installation

Install using ``pip``\ …

.. code:: bash

    $ pip install django-jsonp

Usage
-----

.. code:: python

    from djsonp import jsonp, JSONPResponse, get_callback

    # decorate something that returns a dict-like object
    @jsonp
    def my_view(request):
        return {'foo': 'bar'}
        

    # it can work with an HttpResponse instances
    @jsonp
    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

    @jsonp
    class DictResponse(View):
        def get(self, request):
            return HttpResponse("{'foo': 'bar'}")

.. |Coverage Status| image:: https://coveralls.io/repos/ZhukovAlexander/django-jsonp/badge.svg?branch=master&service=github
   :target: https://coveralls.io/github/ZhukovAlexander/django-jsonp?branch=master
.. |Build Status| image:: https://travis-ci.org/ZhukovAlexander/django-jsonp.svg
   :target: https://travis-ci.org/ZhukovAlexander/django-jsonp
.. |PyPI version| image:: https://badge.fury.io/py/django_jsonp.svg
   :target: http://badge.fury.io/py/django_jsonp
.. |Scrutinizer Code Quality| image:: https://scrutinizer-ci.com/g/ZhukovAlexander/django-jsonp/badges/quality-score.png?b=master
   :target: https://scrutinizer-ci.com/g/ZhukovAlexander/django-jsonp/?branch=master
.. |Code Health| image:: https://landscape.io/github/ZhukovAlexander/django-jsonp/master/landscape.svg?style=flat
   :target: https://landscape.io/github/ZhukovAlexander/django-jsonp/master