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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-weasyprint-0.5.1.tar.gz.
File metadata
- Download URL: django-weasyprint-0.5.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2613816d09b44a63a8fe20c4d0cc31a9648cfd0d77a149644310a996fd47b3b3
|
|
| MD5 |
3323e9eb658fd672160abc4f9f8c6bd5
|
|
| BLAKE2b-256 |
f3c4662a515085033e654f6036db2757ef9898c570b4ab58a4d1e67c3d8ad383
|
File details
Details for the file django_weasyprint-0.5.1-py2.py3-none-any.whl.
File metadata
- Download URL: django_weasyprint-0.5.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a0d1d545054751028cc45b5b89634a2d5bc90eee1e62385126f69018209b818
|
|
| MD5 |
56e073541ef6de84ffe107bd3896f092
|
|
| BLAKE2b-256 |
9cab6ec13ff9c5e206006c7cdeffb4c0687aae6f8c66774725a9784063e00d8d
|