coalition.endorsements.models ============================= .. py:module:: coalition.endorsements.models Classes ------- .. autoapisummary:: coalition.endorsements.models.Endorsement Module Contents --------------- .. py:class:: Endorsement(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Represents a stakeholder's endorsement of a policy campaign. The endorsement workflow involves multiple steps: 1. Initial submission (status: pending) 2. Email verification (status: verified) 3. Administrative review (status: approved/rejected) 4. Public display (if approved and consent given) Each endorsement links a stakeholder to a campaign and includes verification tokens, submission metadata, and moderation tracking. Only one endorsement per stakeholder per campaign is allowed. .. py:attribute:: STATUS_CHOICES :value: [('pending', 'Pending Email Verification'), ('verified', 'Email Verified'), ('approved',... .. py:attribute:: stakeholder .. py:attribute:: campaign .. py:attribute:: statement .. py:attribute:: public_display .. py:attribute:: verification_token .. py:attribute:: email_verified .. py:attribute:: verification_sent_at .. py:attribute:: verified_at .. py:attribute:: status .. py:attribute:: admin_notes .. py:attribute:: reviewed_by .. py:attribute:: reviewed_at .. py:attribute:: terms_accepted .. py:attribute:: terms_accepted_at .. py:attribute:: org_authorized .. py:attribute:: display_publicly .. py:attribute:: created_at .. py:attribute:: updated_at .. py:class:: Meta .. py:attribute:: db_table :value: 'endorsement' .. py:attribute:: unique_together :value: ['stakeholder', 'campaign'] .. py:method:: __str__() -> str .. py:method:: save(*args: Any, **kwargs: Any) -> None Sanitize statement field before saving to prevent XSS attacks. .. py:property:: is_verification_expired :type: bool Check if email verification link has expired (24 hours) .. py:property:: should_display_publicly :type: bool Check if endorsement should be displayed publicly .. py:method:: approve(user: django.contrib.auth.models.User | None = None) -> None Approve endorsement for public display .. py:method:: reject(user: django.contrib.auth.models.User | None = None, notes: str = '') -> None Reject endorsement .. py:method:: verify_email() -> None Mark email as verified and auto-approve if configured