From e33204d448187ee5989f59c8b2aa32cd2b7ac30c Mon Sep 17 00:00:00 2001 From: inlanger Date: Sun, 28 Sep 2014 23:40:02 +0200 Subject: [PATCH] Add a Django response method Why not? --- pygal/ghost.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pygal/ghost.py b/pygal/ghost.py index 7e1dab6..db9e4fd 100644 --- a/pygal/ghost.py +++ b/pygal/ghost.py @@ -142,6 +142,11 @@ class Ghost(object): """Render the graph, and return a Flask response""" from flask import Response return Response(self.render(**kwargs), mimetype='image/svg+xml') + + def render_django_response(self, **kwargs): + """Render the graph, and return a Django response""" + from django.http import HttpResponse + return HttpResponse(self.render(**kwargs), mimetype='image/svg+xml') def render_to_file(self, filename, **kwargs): """Render the graph, and write it to filename"""