Legal documents#
This page lists what a FairDM portal has for legal documents: the pages, the URL names, the permissions, the models you can query and the system checks. It does not describe the settings, which are in Settings, or who is asked to agree, which is in Who is asked to agree to a legal document.
FairDM installs django-mvp-compliance, the mvp_compliance app, and wires it in for every portal that calls fairdm.setup():
mvp_complianceis inINSTALLED_APPS.mvp_compliance.middleware.AgreementMiddlewareis inMIDDLEWARE.fairdm.conf.urlsmountsmvp_compliance.urlsunderlegal/.An Agreements entry is added to the account area’s menu.
FairDM ships no documents. Until your portal publishes one, there are no pages under /legal/ and the check asks nobody anything.
Pages and URL names#
URL name |
Address |
Who may open it |
What it shows |
|---|---|---|---|
|
|
Everyone |
A document in the version in force. |
|
|
Signed-in people |
The documents outstanding for the person, each with a toggle. Accepts a |
|
|
Signed-in people |
The person’s own list of the versions they accepted |
The document page answers “not found” for a slug that names no document, a document with nothing published and a ?version= value that names no published version. It answers the same way to a signed-in person as to a visitor.
The agreed page answers “not found” in a portal whose URL configuration has no account-center name.
The slugs agree and agreed are reserved and cannot name a document.
Documents and versions#
A document has a name, a slug and a kind. A version holds the text.
Field |
Type |
Default |
What it does |
|---|---|---|---|
|
|
None |
The name the document is known by. Unique |
|
slug, 100 characters |
None |
The segment of the document’s address. Unique, lowercase. It cannot change once a version is published |
|
|
|
Whether people agree to the document or only read it. Nobody is asked to accept a notice |
|
|
|
Whether a person who has not accepted the document is stopped until they do. It never applies to a notice |
|
text |
None |
The wording, in Markdown |
|
|
|
Set by publishing. A document has at most one current version |
|
|
None |
The year and the version’s place among that year’s versions, such as |
A published version can never be edited. A correction is a new version.
Creating a document from code#
from mvp_compliance.models import Document
terms = Document.objects.create(name="Terms of use", slug="terms-of-use")
terms.versions.create(markdown="# Terms of use\n\n...").publish()
Version.publish(publisher=None) makes a draft the version in force and supersedes the one that held it. It raises PublishError when the version is not a draft, when its rendered output is empty and when it says exactly what the version in force says.
Queries#
Method |
Returns |
|---|---|
|
The documents that have a version in force |
|
The documents whose version in force |
|
The outstanding documents that are enforced |
|
The version in force, or |
|
|
Permissions#
All belong to the mvp_compliance app.
Permission |
What it allows |
|---|---|
|
Writing documents in the administration interface |
|
Writing draft versions |
|
Publishing a version, which puts it in force at once |
|
Going on without accepting the enforced documents. Superusers are never stopped |
None of the four portal roles holds these.
System checks#
The checks run only when AgreementMiddleware is in MIDDLEWARE.
ID |
Severity |
It reports |
|---|---|---|
|
Error |
The page that asks has no address, because |
|
Error |
Nothing that identifies the signed-in user comes before |
|
Error |
|
|
Error |
|