Returning JSON/JSONP from a Django view with a little decorator help This is a decorator that helps creating a JSON response: def json_response(func): """ A decorator thats takes a view response and turns it into json. If a callback is added through GET or POST the response is JSONP. """ def decorator(request, *args, **kwargs): objects = func(request, *args, **kwargs) if isinstance(objects, HttpRe