diff --git a/tailbone/views/core.py b/tailbone/views/core.py index 45047c7b..57dcf5aa 100644 --- a/tailbone/views/core.py +++ b/tailbone/views/core.py @@ -111,6 +111,13 @@ class View(object): kwargs.setdefault('can_cancel', True) return render_to_response(template, kwargs, request=self.request) + def json_response(self, data): + """ + Convenience method to return a JSON response. + """ + return render_to_response('json', data, + request=self.request) + def file_response(self, path): """ Returns a generic FileResponse from the given path