Django WeasyPrint CBV
Project description
A Django class-based view generating PDF responses using WeasyPrint.
Installing
Install and update using pip:
pip install -U django-weasyprint
Usage
Use WeasyTemplateView as class based view base class or the just the mixin WeasyTemplateResponseMixin on a TemplateView (or subclass thereof).
Example
from django.conf import settings
from django.views.generic import DetailView
from django_weasyprint import WeasyTemplateResponseMixin
class MyModelView(DetailView):
model = MyModel
template_name = 'mymodel.html'
class MyModelViewPrintView(WeasyTemplateResponseMixin, MyModelView):
pdf_stylesheets = [
settings.STATIC_ROOT + 'css/app.css',
]
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django_weasyprint-0.5.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a10d9d44b69041fe7a2807aa86837ffc9321fa907c2a1fd3d077acf3a538d420 |
|
MD5 | 09b4b0ee7f68d1308b9d6d48ec0b79d8 |
|
BLAKE2b-256 | c33fe73b650c5cf5cfd5b9c8024ea86872ed27d65edd52a906ad0732bcefa55a |