aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Denton <charlie@meshy.co.uk>2012-02-23 16:47:01 +0000
committerCharlie Denton <charlie@meshy.co.uk>2012-02-23 16:47:01 +0000
commitea778c6f7b3df11b4fbb106f64cd8f64da99270e (patch)
treeedf0be4ee91669baca07ce82674f2b23093acfe5
parent6cf05d70a87cd33955670d43f14f28067f90379e (diff)
downloaddjango-wkhtmltopdf-ea778c6f7b3df11b4fbb106f64cd8f64da99270e.tar.gz
django-wkhtmltopdf-ea778c6f7b3df11b4fbb106f64cd8f64da99270e.tar.bz2
django-wkhtmltopdf-ea778c6f7b3df11b4fbb106f64cd8f64da99270e.zip
Deprecate baDly cApitalised Views.
-rw-r--r--wkhtmltopdf/views.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py
index 0c1ec4c..1d6e38e 100644
--- a/wkhtmltopdf/views.py
+++ b/wkhtmltopdf/views.py
@@ -8,13 +8,21 @@ from django.views.generic import TemplateView
from wkhtmltopdf.utils import template_to_temp_file, wkhtmltopdf
-class PdfResponse(HttpResponse):
+
+class PDFResponse(HttpResponse):
def __init__(self, content, filename):
super(PdfResponse, self).__init__(content, 'application/pdf')
self.__setitem__('Content-Disposition', 'attachment; filename=%s' % filename)
-class PdfTemplateView(TemplateView):
+class PdfResponse(PDFResponse):
+ def __init__(self, content, filename):
+ warning = '''PdfTemplateView is deprecated in favour of PDFTemplateView. It will be removed in version 1.'''
+ raise PendingDeprecationWarning(warning)
+ super(PdfResponse, self).__init__(content, filename)
+
+
+class PDFTemplateView(TemplateView):
filename = 'rendered_pdf.pdf'
footer_template = None
header_template = None
@@ -59,3 +67,9 @@ class PdfTemplateView(TemplateView):
return context
+
+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