add json_response
This commit is contained in:
parent
6e0d64d972
commit
c3425506cc
1 changed files with 3 additions and 0 deletions
|
@ -11,6 +11,9 @@ class HttpErrorJson(Http404):
|
||||||
def __init__(self, response):
|
def __init__(self, response):
|
||||||
self.response = response
|
self.response = response
|
||||||
|
|
||||||
|
def json_response(data={}, status=200, text='ok'):
|
||||||
|
return {'status': {'code': status, 'text': status_text}, 'data': data}
|
||||||
|
|
||||||
def render_to_json_response(dictionary, content_type="text/json", status=200):
|
def render_to_json_response(dictionary, content_type="text/json", status=200):
|
||||||
indent=None
|
indent=None
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|
Loading…
Reference in a new issue