django-pdf lets you to render any view as pdf, css and images are also available in your templates.
- django>=1.3
2. xhtml2pdf==0.0.5 5. mock (for testing)
Use pip to install:
pip install django-pdfy
- Define
STATIC_ROOT
andSTATIC_URL
in your settings.py file. - Subclass RenderPDF, set the
template_name
attribute.
For example, in myapp/views.py:
from myapp.models import Transaction from pdfy.views import RenderPDF from django.views.generic import ListView class TransactionListView(RenderPDF, ListView): template_name = 'mypdf.html' model = Transaction
In myapp/urls.py:
from myapp.views import TransactionListView urlpatterns = patterns('', url(r'^transactions/$', TransactionListView.as_view()), )
You can run the tests with via:
python setup.py test
or:
python runtests.py
django-secure-input is released under the BSD License. See the LICENSE file for more details.
If you think you've found a bug or are interested in contributing to this project check out django-pdfy on Github.
Development sponsored by RochApps, LLC.