Django templates
Jinja2 templates for Django and sturnus apps ship in
src/templates/stylescape/ (outside this demo folder): a base page on
the ss-l-app shell; list, detail, form and confirm-delete pages;
macros for form fields, forms, formsets, pagination, breadcrumbs, tables, the
page header and messages; and the auth pages. Below is their output for a
paginated list and an invalid form, rendered by Python Jinja2 with real Django
forms and a Django Paginator, inside a contained shell.
List page
stylescape/pages/list.html.jinja with columns, page_obj and two messages.
| Project | Status | Owner | Budget |
|---|---|---|---|
| Harbour quay renewal | Active | Anna de Vries | € 1.2 m |
| Ferry terminal | Paused | Bram Jansen | € 640 k |
| Dune path lighting | Active | Chris Bakker | € 85 k |
| Lock gate sensors | Active | Dewi Visser | € 210 k |
| Pier 4 decking | Paused | Eva Smit | € 120 k |
| Bike parking | Active | Femke de Boer | € 40 k |
Form page
stylescape/pages/form.html.jinja with a bound, invalid form and a formset.
Usage
Add the package's template folder to the Jinja2 backend and extend a page:
# settings.py (the Jinja2 / sturnus.context.jinja2.Jinja2 backend)
TEMPLATES[0]["DIRS"] = [BASE_DIR / "node_modules" / "stylescape" / "src" / "templates"]
{# projects/templates/projects/project_list.html.jinja #}
{% extends "stylescape/pages/list.html.jinja" %}
{% block title %}{{ _("Projects") }}{% endblock %}