Metadata-Version: 2.0
Name: django-weasyprint
Version: 0.5.4
Summary: Django WeasyPrint CBV
Home-page: https://github.com/fdemmer/django-weasyprint
Author: Florian Demmer
Author-email: fdemmer@gmail.com
License: Apache-2.0
Download-URL: https://github.com/fdemmer/django-weasyprint/archive/v0.5.4.tar.gz
Description-Content-Type: UNKNOWN
Platform: UNKNOWN
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Framework :: Django
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Requires-Dist: Django (>=1.8)
Requires-Dist: WeasyPrint

django-weasyprint
=================

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

Installing
----------

Install and update using `pip`_:

.. code-block:: text

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

.. code:: python

    from django.conf import settings
    from django.views.generic import DetailView

    from django_weasyprint import CONTENT_TYPE_PNG, WeasyTemplateResponseMixin


    class MyModelView(DetailView):
        # vanilla Django DetailView
        model = MyModel
        template_name = 'mymodel.html'


    class MyModelPrintView(WeasyTemplateResponseMixin, MyModelView):
        # output of DetailView rendered as PDF
        pdf_stylesheets = [
            settings.STATIC_ROOT + 'css/app.css',
        ]


    class MyModelImageView(WeasyTemplateResponseMixin, MyModelView):
        # generate a PNG image instead
        content_type = CONTENT_TYPE_PNG


Links
-----

* Releases: https://pypi.python.org/pypi/django-weasyprint
* Issue tracker: https://github.com/fdemmer/django-weasyprint/issues
* Code: https://github.com/fdemmer/django-weasyprint


.. _pip: https://pip.pypa.io/en/stable/quickstart
.. _Django: https://www.djangoproject.com
.. _WeasyPrint: http://weasyprint.org


