✅ Purpose

Stores a block of buttons and labels that can be embedded into a template.

🧩 Fields

  • name — unique name
  • CSS — optional container CSS
  • HTML — optional custom container HTML
  • background_image — optional image (.jpg/.jpeg/.png/.gif/.webp, max 10 MB, 5000×3000)
  • preview — optional preview image (.jpg/.jpeg/.png, max 5 MB, 2000×2000)
  • notes — optional
  • owner — FK to User
  • created_at, updated_at

🧠 Properties & methods

  • rendered_background_image

    • returns url('media/<file>') or none
  • render_html()

    • if HTML is provided: uses label_1, button_1, etc. variables
    • otherwise uses BASE_BUTTONS_CONTAINER_TEMPLATE
    • if CSS is empty: generates a default style (flex column, gap, padding)
    • uses Jinja2 with KeepUndefined
  • copy(user=None)

    • clones the container with a [copy <timestamp>] prefix
    • deep‑copies all Labels and Buttons
  • __str__() → returns name

🔗 Relations

  • Label.buttons_container
  • Button.buttons_container
  • Landing.buttons_container