django-legal
This Django app adds support for versioned terms of service.
Installation
Install with pip:
$ pip install django-legal
Add legal to your INSTALLED_APPS setting.
(Optional) Add a new setting: LEGAL_TOS_NAME = 'terms_of_service'
Update urls.py with the following:
url(r'^legal/', include('legal.urls')),Create a new Agreement and AgreementVersion (ideally via data migration):
# -*- coding: utf-8 -*- import os from south.v2 import DataMigration # This should be the same value as LEGAL_TOS_NAME (if you overrode it) AGREEMENT_NAME = 'tos' class Migration(DataMigration): def forwards(self, orm): agreement, created = orm['legal.Agreement'].objects.get_or_create(name=AGREEMENT_NAME) # This file should live in the same directory as the migration f = open('%s/tos_content_2013_08_01.html' % os.path.dirname(__file__), 'r') orm['legal.AgreementVersion'].objects.create(agreement=agreement, date='2013-08-01', content=f.read()) def backwards(self, orm): agreement = orm['legal.Agreement'].objects.get(name=AGREEMENT_NAME) agreement.delete() models = { 'legal.agreement': { 'Meta': {'object_name': 'Agreement'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ( 'django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}) }, 'legal.agreementversion': { 'Meta': {'ordering': "['-date']", 'unique_together': "(('agreement', 'date'),)", 'object_name': 'AgreementVersion'}, 'agreement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['legal.Agreement']"}), 'content': ('django.db.models.fields.TextField', [], {}), 'date': ('django.db.models.fields.DateTimeField', [], {}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) } } # Change this to be the name of the app where the migration lives complete_apps = ['my-app'] symmetrical = True
Testing This App
A modified manage.py and Django settings file are included to test this app:
$ python manage.py test
Testing Your App
You may find the middleware a bit excessive for your tests as it requires you to create an agreement and version, and accept the agreement on behalf of your tests users. If you want to disable the middleware, add the following to your settings:
if 'test' in sys.argv:
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES.remove('legal.middleware.TermsOfServiceAcceptanceMiddleware')
Metadata
Release files for django-legal 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-legal-1.0.tar.gz | 8.4 kB | Without provenance | Details for django-legal-1.0.tar.gz |
Release files / django-legal-1.0.tar.gz
| Download URL | django-legal-1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
478cd870e4de0446f965fd63c14ac682235a1e3d0d1264c545dab050b8287d01
|
|
BLAKE2b-256 checksum How to use checksums |
9b428173e9d42b5e06d6615a99b0e1d8e1ed37eb0ba128a951cb262754064ccf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-legal 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.