Add Django site, Docker packaging, and beta/prod Gitea deploys.
Unignore site/ (was blocked by mkdocs /site rule), add compose/Docker/uv tooling, and split deploys so push to main goes to beta while prod stays manual.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from django.db import models
|
||||
|
||||
from core.models import TimeStampedModel, UUIDPrimaryKeyModel
|
||||
from leads.models import Lead
|
||||
|
||||
|
||||
class UTMVisit(UUIDPrimaryKeyModel, TimeStampedModel):
|
||||
correlation_id = models.CharField(max_length=64, db_index=True)
|
||||
path = models.CharField(max_length=512, blank=True)
|
||||
referrer = models.URLField(blank=True, max_length=1024)
|
||||
utm_source = models.CharField(max_length=128, blank=True)
|
||||
utm_medium = models.CharField(max_length=128, blank=True)
|
||||
utm_campaign = models.CharField(max_length=128, blank=True)
|
||||
utm_term = models.CharField(max_length=128, blank=True)
|
||||
utm_content = models.CharField(max_length=128, blank=True)
|
||||
user_agent = models.CharField(max_length=512, blank=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-created_at"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.utm_source or 'direct'} / {self.path}"
|
||||
|
||||
|
||||
class Attribution(TimeStampedModel):
|
||||
lead = models.OneToOneField(
|
||||
Lead, on_delete=models.CASCADE, related_name="attribution"
|
||||
)
|
||||
visit = models.ForeignKey(
|
||||
UTMVisit, null=True, blank=True, on_delete=models.SET_NULL
|
||||
)
|
||||
utm_source = models.CharField(max_length=128, blank=True)
|
||||
utm_medium = models.CharField(max_length=128, blank=True)
|
||||
utm_campaign = models.CharField(max_length=128, blank=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"attr {self.lead_id} ← {self.utm_source or 'direct'}"
|
||||
Reference in New Issue
Block a user