PDF Views for Models
Version 0.2 of wagtail-pdf-view
brings support for rendering PDF views of models.
Use-cases include:
- rendering customer invoices
- creating participation lists of members in your organization
- rendering tickets
- and many more!
Since models do not use wagtails draft system, there are no previews for the model PDFs.
Unlike PDF view pages, PDF rendered models are useful for rather simple content, or for generated content.
This version offers you three different ways to include the rendered PDF models in your page
/admin
restricted content, managed byModelAdmin
- public content, managed by
ModelAdmin
- public content, the view is directly embedded in your
urls.py
Version changes:
PdfModelMixin
implements basic functionalities needed to render a model as PDF- New file
modeladmin/mixins.py
:ModelAdminPdfViewMixin
automatically create a public view for the inheriting model (with action 'live')ModelAdminPdfAdminViewMixin
automatically create a/admin
restricted view for the inheriting model (with action 'pdf')ExtendableButtonHelperMixin
allows to append custom buttons toModelAdmin
sButtonHelper
easierCustomActionPermissionHelperMixin
implements generalized permission check functionuser_can_perform_action()
- The new file
urls.py
loads URLs from the new wagtail hookregister_pdf_site_urls
AdminViewMixin
can be used to require view permissions on a modelWagtailTexAdminView
andWagtailWeasyAdminView
implement the restricted views fortex
andWeasyprint
- The more customized class
PDFDetailView
extends the inheritance fromBaseDetailView
in WagtailTexView and WagtailWeasyView - HTTP-Content from
PdfViewPageMixin.serve_pdf()
moved toPDFDetailView
Bugfixes:
- Reversing URLs is now fixed (
MultipleViewPageMixin.__init_subclass__()
was extended)