Skip to content
This repository has been archived by the owner on Jul 5, 2019. It is now read-only.

A Django class-based view generating PDF resposes using WeasyPrint

License

Notifications You must be signed in to change notification settings

founders4schools/django-weasyprint

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-weasyprint

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

About

A Django class-based view generating PDF resposes using WeasyPrint

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 91.5%
  • Makefile 8.5%