aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf')
-rw-r--r--wkhtmltopdf/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py
index b8e31d4..b15d7be 100644
--- a/wkhtmltopdf/views.py
+++ b/wkhtmltopdf/views.py
@@ -3,6 +3,7 @@ from re import compile
from django.conf import settings
from django.contrib.sites.models import Site
+from django.template.context import RequestContext
from django.template.response import HttpResponse
from django.views.generic import TemplateView
@@ -37,7 +38,10 @@ class PDFTemplateView(TemplateView):
if request.GET.get('as', '') == 'html':
return super(PDFTemplateView, self).get(request, *args, **kwargs)
- self.context_instance = context_instance
+ if context_instance:
+ self.context_instance = context_instance
+ else:
+ self.context_instance = RequestContext(request, self.get_context_data(**kwargs))
page_path = template_to_temp_file(self.get_template_names(), self.get_context_data(), self.context_instance)
pdf_kwargs = self.get_pdf_kwargs()
@@ -80,4 +84,4 @@ class PdfTemplateView(PDFTemplateView): #TODO: Remove this in v1.0
def as_view(cls, **initkwargs):
warning = '''PdfTemplateView is deprecated in favour of PDFTemplateView. It will be removed in version 1.'''
raise PendingDeprecationWarning(warning)
- return super(PdfTemplateView, cls).as_view(**initkwargs) \ No newline at end of file
+ return super(PdfTemplateView, cls).as_view(**initkwargs)