Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Django WeasyPrint CBV

Project Description

A Django class-based view generating PDF responses using WeasyPrint.


Install and update using pip:

pip install -U django-weasyprint


Use WeasyTemplateView as class based view base class or the just the mixin WeasyTemplateResponseMixin on a TemplateView (or subclass thereof).


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',

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(6.9 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Mar 8, 2018
(4.9 kB) Copy SHA256 Hash SHA256
Source None Mar 8, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers