Files
monica_site/site/public/context_processors.py
westfarn 71de919c34
Deploy Beta / unit-tests (push) Successful in 13s
Deploy Beta / docker (push) Successful in 17s
Deploy Beta / deploy-beta (push) Successful in 1m57s
Update public About bio, address, and headshot (#2)
## Summary
Closes #1.

- Replace About page bio with the western-suburbs / Exit Realty Redefined copy and Monica's headshot
- Add `CONTACT_ADDRESS` (`1245 Butterfield Rd. #100, Wheaton, IL 60189`) and show it on Contact, nav, footer, and structured data
- Align Home hero + service-area defaults with Chicago's western suburbs

## Test plan
- [ ] `/about/` shows new bio and headshot
- [ ] `/contact/` map block shows Butterfield Rd address
- [ ] Header / footer on Home show the address
- [ ] Set `CONTACT_ADDRESS` in deploy `.env` if not relying on defaults
- [ ] Confirm OG image for About uses the new headshot

Reviewed-on: #2
2026-08-20 03:35:33 -07:00

74 lines
2.5 KiB
Python

import re
from django.conf import settings
def _phone_tel(phone: str) -> str:
digits = re.sub(r"[^\d+]", "", phone or "")
return digits
def site_branding(request):
phone = settings.CONTACT_PHONE or ""
public_site_url = (getattr(settings, "PUBLIC_SITE_URL", None) or "").rstrip("/")
if not public_site_url and getattr(request, "build_absolute_uri", None):
public_site_url = request.build_absolute_uri("/").rstrip("/")
return {
"SITE_NAME": settings.SITE_NAME,
"SITE_TAGLINE": settings.SITE_TAGLINE,
"PUBLIC_SITE_URL": public_site_url,
"CONTACT_PHONE": phone,
"CONTACT_PHONE_TEL": _phone_tel(phone),
"CONTACT_EMAIL": settings.CONTACT_EMAIL or "",
"CONTACT_ADDRESS": getattr(settings, "CONTACT_ADDRESS", "") or "",
"CONTACT_SERVICE_AREA": getattr(
settings,
"CONTACT_SERVICE_AREA",
"Serving Chicago's western suburbs",
),
"CREDIT_NAME": getattr(settings, "CREDIT_NAME", "AI ML Operations, LLC"),
"CREDIT_URL": getattr(
settings, "CREDIT_URL", "https://aimloperations.com"
),
"SITE_UNDER_CONSTRUCTION": settings.SITE_UNDER_CONSTRUCTION,
}
def tianji_tracking(request):
match = getattr(request, "resolver_match", None)
url_name = getattr(match, "url_name", "") or ""
namespace = getattr(match, "namespace", "") or ""
full = f"{namespace}:{url_name}" if namespace else url_name
nav_section = ""
if full == "dashboard:home":
nav_section = "dashboard"
elif namespace == "leads":
nav_section = "leads"
elif full == "analytics:report":
nav_section = "analytics"
elif namespace == "contacts":
nav_section = "contacts"
elif full == "messaging:postcard_designer":
nav_section = "postcard"
elif namespace == "messaging":
nav_section = "campaigns"
elif full == "social:account_list":
nav_section = "social_accounts"
elif namespace == "social":
nav_section = "social"
return {
"tianji_enabled": getattr(settings, "TIANJI_ENABLED", False)
and bool(getattr(settings, "TIANJI_WEBSITE_ID", ""))
and bool(getattr(settings, "TIANJI_TRACKER_URL", "")),
"tianji_tracker_url": getattr(
settings,
"TIANJI_TRACKER_URL",
"https://tianji.aimloperations.com/tracker.js",
),
"tianji_website_id": getattr(settings, "TIANJI_WEBSITE_ID", ""),
"page_name": url_name,
"nav_section": nav_section,
}