Architecture of a Runique Project

Tera Tags and Filters

Django-like Tags (syntactic sugar)

TagTransformed intoDescription
{% static "..." %}{{ "..." | static }}Static file URL
{% media "..." %}{{ "..." | media }}Media file URL
{% csrf %}{% include "csrf" %}Hidden CSRF field
{% messages %}{% include "message" %}Display flash messages
{% csp %}{% include "csp" %}CSP nonce attribute
{% link "name" %}{{ link(link='name') }}Named route URL
{% form.xxx %}{{ xxx | form | safe }}Full form rendering
{% form.xxx.field %}{{ xxx | form(field='field') | safe }}Single field rendering
{% form.xxx.js %}{{ xxx | form(field='js') | safe }}Form JS scripts (field-by-field rendering)

Tera Filters

FilterDescription
staticApp static URL prefix
mediaApp media URL prefix
formRender full form or specific field
csrf_fieldGenerate a hidden CSRF input

Tera Functions

FunctionDescription
link(link='...')Named URL resolution

In context

The tags combine in a real template:

{% extends "base.html" %}

{% block content %}
  <link rel="stylesheet" href="{% static "css/contact.css" %}">

  {% messages %}

  <form method="post" action="{% link "contact" %}">
    {% form.contact_form %}
    <button type="submit">Send</button>
  </form>

  <img src="{% media avatar %}" alt="avatar">
{% endblock %}

{% static %} / {% media %} accept a string literal or a Tera variable (avatar above). See Django-like tags for the details of each tag.