✅ Purpose
Defines the HTML/CSS structure of a landing and optional JS files.
🧩 Fields
name— unique nameCSS— optional CSS text (stored under field nameCSS)HTML— required HTML template (Jinja2)java_script_files— Many‑to‑Many to JavaScriptFilepreview— optional image (.jpg/.jpeg/.png, max 5 MB, 2000×2000)notes— optionalowner— FK to Usercreated_at,updated_at
🧠 Methods
-
render_html()- renders
HTMLusing Jinja2 - context includes
css(fromCSSfield) - unknown variables are preserved (
KeepUndefined)
- renders
-
copy(user=None)- creates a new Template with name
[copy <timestamp>] <original name> - copies CSS, HTML, preview, notes
- copies all JavaScriptFile relations
- creates a new Template with name
-
__str__()→ returnsname
🔗 Relations
Landing.template— each Landing uses one Template