{#- Admin form to add or edit an event. typed holds what a refused save sent, when the view shows the form again with the reason flashed above it, so the fields keep what was typed instead of what is stored. Without it the fields show the stored event. Slot for features that build on events: events.admin.form.fields called with hook(event), where event is None on create; extra fields after Kind. On a POST the form is a refused save shown again, and a field reads what was sent from request.form. -#} {% extends "base_template.html" %} {%- set typed = typed if typed is defined else none %} {%- macro shown(name, stored) -%} {{ typed.get(name, '') if typed is not none else stored }} {%- endmacro %} {% block title %}{{ 'Edit event' if event else 'Add event' }}{% endblock %} {% block content %}

{{ 'Edit event' if event else 'Add event' }}

← Back to events
{#- A save sent back to the form says why here, since the panel's layout draws no flashed message of its own. -#} {% with messages = get_flashed_messages(with_categories=true) %} {% for category, message in messages %}
{{ message }}
{% endfor %} {% endwith %}
{% for g in known_groups %}
Type a new name to create a new kind.
{% for hook in get_template_hooks("events.admin.form.fields") %} {{ (hook(event) or "") | safe }} {% endfor %}
{%- set published = ('published' in typed) if typed is not none else (event.published if event else True) %}
{% endblock %}