Metadata-Version: 2.1
Name: django-legaltext
Version: 1.0.0
Summary: django-legaltext helps to manage legal text versioning.
Home-page: https://github.com/moccu/django-legaltext/
Author: Moccu GmbH & Co. KG
Author-email: info@moccu.com
License: BSD
Keywords: legaltext,django
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.9
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.11
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Requires-Dist: Django (>=2)
Requires-Dist: django-floppyforms (>=1.8)
Requires-Dist: django-markymark (>=2.0)
Provides-Extra: tests
Requires-Dist: pytest (<5.4,>=5.3) ; extra == 'tests'
Requires-Dist: pytest-cov (<3,>=2.8.1) ; extra == 'tests'
Requires-Dist: pytest-django (<4,>=3.9.0) ; extra == 'tests'
Requires-Dist: pytest-flakes (<5,>=4.0.0) ; extra == 'tests'
Requires-Dist: pytest-isort (<1,>=0.3.1) ; extra == 'tests'
Requires-Dist: pytest-pep8 (<2,>=1.0.6) ; extra == 'tests'
Requires-Dist: factory-boy (<3,==2.12.0) ; extra == 'tests'
Requires-Dist: freezegun (<1,>=0.3.15) ; extra == 'tests'
Requires-Dist: isort (<4.4,>=4.3.21) ; extra == 'tests'
Requires-Dist: coverage (>=4.0) ; extra == 'tests'
Requires-Dist: tox ; extra == 'tests'
Requires-Dist: tox-pyenv ; extra == 'tests'

================
django-legaltext
================

.. image:: https://badge.fury.io/py/django-legaltext.svg
    :target: https://pypi.python.org/pypi/django-legaltext
    :alt: Latest PyPI version

.. image:: https://travis-ci.org/moccu/django-legaltext.svg?branch=master
    :target: https://travis-ci.org/moccu/django-legaltext
    :alt: Latest Travis CI build status


Legaltext is a Django application to help managing legal text versioning (e.g.
terms of condition, pr privacy policy). It also supports versioning of the
corresponding checkbox labels.


Features
========

The application consists of multiple parts and helpers:

* Models to maintain legal texts, their versions and checkboxes
* Model field to store the accepted version of a legal text (with support to
  auto-fetched default of current version)
* Form field to render the widget which outputs the configured checkboxes just
  using the legal text slug
* Admin interface to maintain the legal texts, adding new version with prefilling, and export
* Templatetag legaltext_url


Installation
============

requirements.txt
~~~~~~~~~~~~~~~~

Just add the following PyPI package to your requirements.txt
::

    django-legaltext


settings.py
~~~~~~~~~~~

To activate the application, add the following two packages to your `INSTALLED_APPS`
::

    INSTALLED_APPS = (
        ...
        'floppyforms',  # needed for widget rendering
        'markymark',  # required for markdown rendering
        'legaltext',
    )


urls.py
~~~~~~~

To register the url to output the legal texts, add the following to your `urls.py`.
::

    urlpatterns = [
        ...
        url(r'^legaltext/', include('legaltext.urls')),
    ]


Usage
=====

Please refer to the examples to learn how to use the application.

You just need to add a new model field to your models and set the correct formfield
in the corresponding forms.


::

    class YourModel(models.Model):
        ...

        accepted_legaltext = LegalTextField('some-unique-slug')


::

    class YourForm(forms.ModelForm):

        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            self.fields['accepted_legaltext'] = LegalTextFormField('some-unique-slug')


Make sure that you use the same slug on both (model and form) field.


Customization
=============

There are some more settings you can set to change the applcation

* `LEGALTEXT_ANCHOR_CLASS`
  Add an additional css class the the rendered anchor-span when using [anchor:foo]
* `LEGALTEXT_VIEW_TEMPLATE`
  Change the template which is used to in the view to output the legal text
* `LEGALTEXT_VIEW_TEMPLATE_OVERRIDES`
  Choose a different template to use in views for specific slugs
* `LEGALTEXT_WIDGET_TEMPLATE`
  Change the template which is used to in the widget to output the checkboxes
* `LEGALTEXT_WIDGET_TEMPLATE_OVERRIDES`
  Choose a different template to use in widget for specific slugs
* `LEGALTEXT_WIDGET_ATTRS`
  Add extra attributes to checkbox input elements
* `LEGALTEXT_SILENCE_TEMPLATE_ERRORS`
  Silence errors for legaltext_url templatetag if legaltext does not exist


Resources
=========

* `Code <https://github.com/moccu/django-legaltext>`_
* `Usage example <https://github.com/moccu/django-legaltext/tree/master/examples>`_


