✅ Purpose

Central entity representing a landing page and its deployment settings.

🧩 Fields

  • name — unique name
  • campaign — FK to Campaign
  • domains — Many‑to‑Many to Domain
  • route — URL path (validated by validate_route)
  • title — optional
  • background — image/video file (.jpg/.jpeg/.png/.gif/.webp/.mp4, max 10 MB)
  • favicon — image (.ico/.png/.jpg/.jpeg/.svg, max 150 KB, 100×100)
  • service_worker — FK to ServiceWorker
  • code_snippet — FK to CodeSnippet
  • template — FK to Template
  • buttons_container — FK to ButtonsContainer
  • click_link, double_link, postback_link, back_link, background_click_link
    • optional URLs validated by validate_url_prefix (http:// or https://)
  • landing_links — JSON list of deployed URLs
  • is_active — deployment flag
  • notes — optional
  • owner — FK to User
  • created_at, updated_at

🧠 Properties & methods

  • rendered_faviconmedia/<file> or empty string

  • rendered_backgroundmedia/<file> or empty string

  • add_landing_link(url)

    • ensures list exists, appends URL, saves
  • remove_landing_links()

    • clears links and deactivates landing
  • get_landing_links()

    • returns list or empty list
  • render_html()

    • builds template context (title, favicon, links, JS tags, etc.)
    • renders ButtonsContainer HTML and injects per‑button overrides
    • renders final template HTML and returns it
  • copy(new_domain, new_route, user=None)

    • creates a new Landing copy
    • checks for existing landing on the new domain/route
    • copies ButtonClick entries
  • __str__() → returns name

🔗 Relations

  • Deployment.landing
  • ButtonClick.landing
  • LandingTransferLog.landing

⚠️ Notes

Route uniqueness is enforced per domain in Admin and in copy().