coalition.legal.models

Models for managing legal documents and user acceptance.

Classes

LegalDocument

Model for storing legal documents like Terms of Use, Privacy Policy, etc.

TermsAcceptance

Track acceptance of legal documents by endorsers.

Module Contents

class coalition.legal.models.LegalDocument(*args, **kwargs)[source]

Bases: django.db.models.Model

Model for storing legal documents like Terms of Use, Privacy Policy, etc.

Supports versioning and tracking of active documents. Only one document of each type can be active at a time.

DOCUMENT_TYPES = [('terms', 'Terms of Use'), ('privacy', 'Privacy Policy'), ('cookies', 'Cookie Policy'),...[source]
document_type[source]
title[source]
content[source]
version[source]
is_active[source]
effective_date[source]
created_at[source]
updated_at[source]
created_by[source]
class Meta[source]
db_table = 'legal_document'[source]
ordering = ['-effective_date', '-created_at'][source]
indexes[source]
unique_together = [['document_type', 'version']][source]
__str__() str[source]
save(*args: Any, **kwargs: Any) None[source]

Ensure only one active document per type and sanitize content.

classmethod get_active_document(document_type: str) LegalDocument | None[source]

Get the currently active document of a specific type.

class coalition.legal.models.TermsAcceptance(*args, **kwargs)[source]

Bases: django.db.models.Model

Track acceptance of legal documents by endorsers.

This model records when someone accepts specific versions of legal documents, particularly Terms of Use during the endorsement process.

endorsement[source]
legal_document[source]
accepted_at[source]
ip_address[source]
user_agent[source]
acceptance_token[source]
class Meta[source]
db_table = 'terms_acceptance'[source]
ordering = ['-accepted_at'][source]
indexes[source]
save(*args: Any, **kwargs: Any) None[source]

Truncate user_agent if it exceeds maximum length.

__str__() str[source]