Template
## Summary - Port Monica campaign UTM + piha.li minting into always-on `core` (`shortener.py`, `campaign_utm.py`) so `email_sms` and `directmail` stay optional and never import each other. - `utm_source` is a slug of `SITE_NAME` (override with `UTM_SOURCE`). Email gets an HTML `data-campaign-utm` link; SMS gets a plain URL; postcard QR only — no body inject. - Live composer mints through login+CSRF `POST /portal/campaigns/short-link/` (registered only when an outreach app is installed). Empty `SHORTENER_*` falls back to the long UTM URL. Reference: [monica_site PR #10](ai_ml_operations/monica_site#10) Closes #3 ## Test plan - [x] `cd site && uv run python manage.py test` (125 tests) - [ ] Email composer: type a name, confirm HTML link + `utm_campaign` updates, save draft - [ ] SMS composer: plain `piha.li` (or long UTM if shortener unset) in the body - [ ] Postcard composer: QR copies the tracked URL; campaign body has no `utm_source` - [ ] Campaign report pages show the same panel - [ ] With `FEATURE_EMAIL_SMS` and `FEATURE_DIRECT_MAIL` off, no extra nav and no `/portal/campaigns/short-link/` route Reviewed-on: #4
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
"""URL configuration. Optional apps are included only when installed."""
|
|
|
|
from django.apps import apps
|
|
from django.contrib import admin
|
|
from django.urls import include, path
|
|
|
|
from contacts.views import address_suggest
|
|
from core.views import campaign_short_link, healthz
|
|
|
|
urlpatterns = [
|
|
path("healthz/", healthz, name="healthz"),
|
|
path("api/address-suggest/", address_suggest, name="address_suggest"),
|
|
path("files/", include("core.urls")),
|
|
path("admin/", admin.site.urls),
|
|
path("accounts/", include("accounts.urls")),
|
|
path("portal/", include("dashboard.urls")),
|
|
path("portal/leads/", include("leads.urls")),
|
|
path("portal/contacts/", include("contacts.urls")),
|
|
path("portal/analytics/", include("analytics.urls")),
|
|
path("", include("public.urls")),
|
|
]
|
|
|
|
if apps.is_installed("email_sms"):
|
|
urlpatterns += [path("portal/messaging/", include("email_sms.urls"))]
|
|
if apps.is_installed("directmail"):
|
|
urlpatterns += [path("portal/direct-mail/", include("directmail.urls"))]
|
|
if apps.is_installed("email_sms") or apps.is_installed("directmail"):
|
|
urlpatterns += [
|
|
path(
|
|
"portal/campaigns/short-link/",
|
|
campaign_short_link,
|
|
name="campaign_short_link",
|
|
),
|
|
]
|
|
if apps.is_installed("blog"):
|
|
urlpatterns += [
|
|
path("blog/", include("blog.public_urls")),
|
|
path("portal/blog/", include("blog.portal_urls")),
|
|
]
|
|
if apps.is_installed("payments"):
|
|
urlpatterns += [
|
|
path("portal/payments/", include("payments.urls")),
|
|
path("pay/", include("payments.public_urls")),
|
|
]
|
|
if apps.is_installed("social"):
|
|
urlpatterns += [path("portal/social/", include("social.urls"))]
|
|
if apps.is_installed("social_ai"):
|
|
urlpatterns += [
|
|
path("portal/social/api/generate/", include("social_ai.urls")),
|
|
]
|
|
|
|
handler404 = "public.views.page_not_found"
|