Skip to content

Commit

Permalink
Updates the README with a CBV example.
Browse files Browse the repository at this point in the history
  • Loading branch information
vierno committed May 30, 2014
1 parent 396e05d commit 50ec619
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ Simply do the following::
result = generate_pdf('my_template.html', file_object=resp)
return result

Class-based views
=================

You can use the provided PdfMixin with any view that subclasses TemplateView,
example::

from django.views.generic.detail import DetailView
from django_xhtml2pdf.views import PdfMixin
from .models import Product

class ProductPdfView(PdfMixin, DetailView):
model = Product
template_name = "product_pdf.html"

It will output the rendered content of the view in pdf.

0 comments on commit 50ec619

Please sign in to comment.