coalition.endorsements.models

Classes

Endorsement

Represents a stakeholder's endorsement of a policy campaign.

Module Contents

class coalition.endorsements.models.Endorsement(*args, **kwargs)[source]

Bases: 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.

STATUS_CHOICES = [('pending', 'Pending Email Verification'), ('verified', 'Email Verified'), ('approved',...[source]
stakeholder[source]
campaign[source]
statement[source]
public_display[source]
verification_token[source]
email_verified[source]
verification_sent_at[source]
verified_at[source]
status[source]
admin_notes[source]
reviewed_by[source]
reviewed_at[source]
terms_accepted[source]
terms_accepted_at[source]
org_authorized[source]
display_publicly[source]
created_at[source]
updated_at[source]
class Meta[source]
db_table = 'endorsement'[source]
unique_together = ['stakeholder', 'campaign'][source]
__str__() str[source]
save(*args: Any, **kwargs: Any) None[source]

Sanitize statement field before saving to prevent XSS attacks.

property is_verification_expired: bool[source]

Check if email verification link has expired (24 hours)

property should_display_publicly: bool[source]

Check if endorsement should be displayed publicly

approve(user: django.contrib.auth.models.User | None = None) None[source]

Approve endorsement for public display

reject(user: django.contrib.auth.models.User | None = None, notes: str = '') None[source]

Reject endorsement

verify_email() None[source]

Mark email as verified and auto-approve if configured