{% extends base_template %} {% comment %} The content screen, used for a page and for a shared section alike. It is not a Django change form and deliberately does not look like one: content is a stack of sections in the order a reader meets them, so this renders them in that order, in cards, one language at a time. `base_template` is the theme's layout where the project has one and the plain admin's where it does not -- see apps/cms/theme.py. Nothing here uses a template tag from the theme, so the page renders either way; without the theme's stylesheet the classes below are simply inert. {% endcomment %} {% load i18n static %} {% block title %}{{ title }} | {{ site_title }}{% endblock %} {% block extrahead %} {{ block.super }} {# The date and time widgets are the admin's own, and the admin's own JS #} {# expects two things a change form provides and a custom page does not: #} {# the translation catalogue, and core.js. Without them calendar.js #} {# throws on load and the picker never appears -- with a 200 in the log #} {# and the field looking like an ordinary text box. #} {{ form.media }} {% endblock %} {% block content %} {# `multipart/form-data` only when something on this screen can carry a #} {# file: a form posted without it drops its uploads silently -- the page #} {# saves, says so, and the picture is not there. #}
{% csrf_token %}

{{ title }}

{% if state %} {# The one fact an editor needs before they start typing: #} {# whether anybody is reading what they are about to change. #} {{ state|lower }} {% endif %} {{ subtitle }} · {% blocktrans %}editing in{% endblocktrans %} {{ language }} {% if language == default_language %}({% trans "default" %}){% endif %} {% if preview %} {% trans "preview" %} {% endif %} {% if structure_url %} {% trans "structure" %} {% endif %}
{# The language switch. A tab per configured language, so which one #} {# is being written is never a guess -- the commonest way to ruin a #} {# translation is to type it into the wrong one. #}
{% if form.errors %}
{% trans "Some values could not be saved. Each one is marked below." %}
{% endif %} {{ form.non_field_errors }}
{% for group in groups %}

{{ group.section.name }}

{% if group.shared %} {# Badged, because editing this changes every page it #} {# is placed on, and nothing else on screen says so. #} {% trans "shared" %} {% trans "edit on its own" %} {% endif %} {% if not group.section.is_active %} {% trans "hidden from the API" %} {% endif %} {{ group.section.slug }}
{% include "admin/cms/_rows.html" with rows=group.rows %} {% for child in group.children %}

{{ child.section.name }} {{ child.section.slug }}

{% include "admin/cms/_rows.html" with rows=child.rows %}
{% endfor %}
{% empty %}
{% trans "Nothing to fill in yet. Sections and their fields are structure, added by a superuser." %} {% if structure_url %} {% trans "Add sections" %} {% endif %}
{% endfor %}
{# Sticky, because a long page must not mean scrolling to the bottom to #} {# save the paragraph at the top. #}
{% trans "An empty box removes this language; readers fall back to" %} {{ default_language }}. {% trans "Back" %}
{% endblock %}