add json_response

This commit is contained in:
j 2010-02-10 18:38:51 +05:30
parent 6e0d64d972
commit c3425506cc
1 changed files with 3 additions and 0 deletions

View File

@ -11,6 +11,9 @@ class HttpErrorJson(Http404):
def __init__(self, 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):
indent=None
if settings.DEBUG: