Template
Extract always-on public/portal/UTM plus optional email_sms, directmail, blog, payments, social, and social_ai so new client sites can be bootstrapped from this seed. Refs #1 Refs #2 Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
from django.conf import settings
|
|
from django.db import models
|
|
|
|
from contacts.models import Contact
|
|
from core.models import TimeStampedModel, UUIDPrimaryKeyModel
|
|
|
|
|
|
class Lead(UUIDPrimaryKeyModel, TimeStampedModel):
|
|
class Status(models.TextChoices):
|
|
NEW = "new", "New"
|
|
CONTACTED = "contacted", "Contacted"
|
|
WON = "won", "Won"
|
|
LOST = "lost", "Lost"
|
|
|
|
contact = models.ForeignKey(Contact, on_delete=models.CASCADE, related_name="leads")
|
|
message = models.TextField(blank=True)
|
|
status = models.CharField(
|
|
max_length=16, choices=Status.choices, default=Status.NEW
|
|
)
|
|
owner = models.ForeignKey(
|
|
settings.AUTH_USER_MODEL,
|
|
null=True,
|
|
blank=True,
|
|
on_delete=models.SET_NULL,
|
|
related_name="leads",
|
|
)
|
|
|
|
class Meta:
|
|
ordering = ["-created_at"]
|
|
|
|
def __str__(self) -> str:
|
|
return f"Lead {self.contact} ({self.status})"
|
|
|
|
|
|
class LeadNote(TimeStampedModel):
|
|
lead = models.ForeignKey(Lead, on_delete=models.CASCADE, related_name="notes")
|
|
author = models.ForeignKey(
|
|
settings.AUTH_USER_MODEL,
|
|
null=True,
|
|
blank=True,
|
|
on_delete=models.SET_NULL,
|
|
)
|
|
body = models.TextField()
|
|
|
|
class Meta:
|
|
ordering = ["-created_at"]
|