Add PCM carrier-route postcard pick-and-send (#15)
CI / test (pull_request) Successful in 24s

## Summary
Closes #15.
- Let compose target mailing-list contacts or 1–2 USPS carrier routes, with household count and estimated cost shown before save.
- Place selected routes through PCM list-count orders instead of importing occupant addresses into Contacts.
This commit is contained in:
westfarn committed 2026-09-21 15:26:32 -05:00
1 parent a867a57750
commit f7e3c05c59
17 files changed
+1211 -28

No files matched your search

+6 -2
View File
@@ -29,6 +29,7 @@ class Campaign(UUIDPrimaryKeyModel, TimeStampedModel):
EMAIL_OPT_IN = "email_opt_in", "Mailing list · email opt-in"
SMS_OPT_IN = "sms_opt_in", "Mailing list · SMS opt-in"
POSTCARD_OPT_IN = "postcard_opt_in", "Mailing list · postcard opt-in"
CARRIER_ROUTE = "carrier_route", "USPS carrier routes"
name = models.CharField(max_length=120)
channel = models.CharField(max_length=16, choices=Channel.choices)
@@ -59,6 +60,8 @@ class Campaign(UUIDPrimaryKeyModel, TimeStampedModel):
body_override = models.TextField(blank=True)
# Set when realtor summary email is sent (campaign COMPLETED).
notify_sent_at = models.DateTimeField(null=True, blank=True)
# PCM purchased-list targeting (ZIP/CRRT codes, listCountID, quote).
route_targeting = models.JSONField(default=dict, blank=True)
class Meta:
ordering = ["-created_at"]
@@ -84,7 +87,7 @@ class Message(UUIDPrimaryKeyModel, TimeStampedModel):
Campaign, on_delete=models.CASCADE, related_name="messages"
)
contact = models.ForeignKey(
Contact, on_delete=models.CASCADE, related_name="messages"
Contact, null=True, blank=True, on_delete=models.CASCADE, related_name="messages"
)
channel = models.CharField(max_length=16, choices=Channel.choices)
status = models.CharField(
@@ -101,7 +104,8 @@ class Message(UUIDPrimaryKeyModel, TimeStampedModel):
ordering = ["-created_at"]
def __str__(self) -> str:
return f"{self.channel} → {self.contact} ({self.status})"
who = self.contact or "carrier-route mailing"
return f"{self.channel} → {who} ({self.status})"
class ProviderEvent(TimeStampedModel):