Skip to main content
Latest PyPI version 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

Release files for django-legaltext 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-legaltext 1.0.0
File Size Uploaded
django-legaltext-1.0.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-legaltext 1.0.0
File Interpreter ABI Platform
django_legaltext-1.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 33.7 kB

Release files / django-legaltext-1.0.0.tar.gz

Download URL django-legaltext-1.0.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ff03499fa0a08eebad3bce35c5050ce153a174edcf2fb1700696cb6c36fc55d9
BLAKE2b-256 checksum
How to use checksums
9d915decca27f48799b0ff609309ec11d1af1458b3646d423865a16964078b15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Release files / django_legaltext-1.0.0-py2.py3-none-any.whl

Download URL django_legaltext-1.0.0-py2.py3-none-any.whl
Size 19.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
428b14194b48c6114b05cde7972ef1cae785580040202f1b2e5a471ce560b0a8
BLAKE2b-256 checksum
How to use checksums
c3ad351c0af3b758e5ba75e5e05c5dfae83bded54a397670e180672d1e4a0354
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.3.0

1 release file

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page