coalition.legal.models ====================== .. py:module:: coalition.legal.models .. autoapi-nested-parse:: Models for managing legal documents and user acceptance. Classes ------- .. autoapisummary:: coalition.legal.models.LegalDocument coalition.legal.models.TermsAcceptance Module Contents --------------- .. py:class:: LegalDocument(*args, **kwargs) Bases: :py:obj:`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. .. py:attribute:: DOCUMENT_TYPES :value: [('terms', 'Terms of Use'), ('privacy', 'Privacy Policy'), ('cookies', 'Cookie Policy'),... .. py:attribute:: document_type .. py:attribute:: title .. py:attribute:: content .. py:attribute:: version .. py:attribute:: is_active .. py:attribute:: effective_date .. py:attribute:: created_at .. py:attribute:: updated_at .. py:attribute:: created_by .. py:class:: Meta .. py:attribute:: db_table :value: 'legal_document' .. py:attribute:: ordering :value: ['-effective_date', '-created_at'] .. py:attribute:: indexes .. py:attribute:: unique_together :value: [['document_type', 'version']] .. py:method:: __str__() -> str .. py:method:: save(*args: Any, **kwargs: Any) -> None Ensure only one active document per type and sanitize content. .. py:method:: get_active_document(document_type: str) -> LegalDocument | None :classmethod: Get the currently active document of a specific type. .. py:class:: TermsAcceptance(*args, **kwargs) Bases: :py:obj:`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. .. py:attribute:: endorsement .. py:attribute:: legal_document .. py:attribute:: accepted_at .. py:attribute:: ip_address .. py:attribute:: user_agent .. py:attribute:: acceptance_token .. py:class:: Meta .. py:attribute:: db_table :value: 'terms_acceptance' .. py:attribute:: ordering :value: ['-accepted_at'] .. py:attribute:: indexes .. py:method:: save(*args: Any, **kwargs: Any) -> None Truncate user_agent if it exceeds maximum length. .. py:method:: __str__() -> str