Example #1
0
def render_data(request):
    """Renders a JSON serialized data
       By now only admins have access to this"""

    user = request.user

    try:
        data = rest_api.get_model_data(request)
        data = rest_api.json_parse(data)

        if user.is_superuser:
            return HttpResponse(
                json.dumps(data, cls=utils.DateTimeEncoder),
                content_type="application/json")
        else:
            return not_allowed_page(request)

    except Exception, e:
        print e
        return HttpResponseBadRequest("Object not found")