runique 2.2.0

A Django-inspired web framework for Rust with ORM, templates, and comprehensive security middleware
Documentation
{% extends "admin_base.html" %}
{% block title %}{% if admin_edit_title %}{{ admin_edit_title }}{% endif %} — {{ resource.title }}{% endblock %}
{% block breadcrumb %}
  {% if parent_key %}
  <span class="admin-topbar__sep">/</span>
  <a href="{{ parent_base }}/{{ parent_id }}/detail">{{ parent_title }}</a>
  {% endif %}
  <span class="admin-topbar__sep">/</span>
  <a href="{{ resource_base }}/list">{{ resource.title }}</a>
  <span class="admin-topbar__sep">/</span>
  <span>{% if admin_edit_breadcrumb %}{{ admin_edit_breadcrumb }}{% endif %}</span>
{% endblock %}
{% block content %}
  {% block edit_header %}
  <header class="admin-page__header">
    <h1>{% if admin_edit_title %}{{ admin_edit_title }}{% endif %} — {{ resource.title }}</h1>
  </header>
  {% endblock %}

  {# Aucun garde de permission ici : MemberAction::Edit.authorize refuse l'accès et
     redirige avant tout rendu, en tenant compte de can_update_own sur un
     enregistrement possédé — ce que le calcul Tera supprimé ici ne faisait pas.
     Tera 2 interdit par ailleurs de placer un bloc dans une condition. #}
  {% block edit_form %}
  <div class="admin-card admin-card--form" data-admin-auto-init>
    <div class="admin-card__header">
      <h2>{% if admin_edit_card_info %}{{ admin_edit_card_info }}{% endif %}</h2>
    </div>
    <div class="admin-card__body">
      <form method="POST" action="{{ resource_base }}/{{ object_id }}/edit" enctype="multipart/form-data">
        {% csrf %}
        {% if orig_updated_at is defined %}
        <input type="hidden" name="__original_updated_at" value="{{ orig_updated_at }}">
        {% elif object?.updated_at is defined %}
        <input type="hidden" name="__original_updated_at" value="{{ object.updated_at }}">
        {% endif %}
        {% if return_qs is defined and return_qs %}
        <input type="hidden" name="return_qs" value="{{ return_qs }}">
        {% endif %}
        {% block edit_form_fields %}
        <div class="form-grid">
          {% if form_fields?.html %}
            {{ form_fields.html }}
          {% else %}
            <p>{% if admin_edit_no_fields %}{{ admin_edit_no_fields }}{% endif %}</p>
          {% endif %}
        </div>
        {% if m2m_fields is defined and m2m_fields %}
        <div class="admin-m2m__fields">
          {% for field in m2m_fields %}
          <div class="form-group admin-m2m__group">
            <label class="form-label">{{ field.label }}</label>
            <div class="admin-m2m__choices">
              {% for choice in field.choices %}
              <label class="admin-m2m__choice">
                <input type="checkbox" name="m2m_{{ field.field_name }}__{{ choice[0] }}" value="1"
                  {% if choice[0] in field.selected %}checked{% endif %}>
                {{ choice[1] }}
              </label>
              {% endfor %}
            </div>
          </div>
          {% endfor %}
        </div>
        {% endif %}
        {% endblock %}
        {% block edit_form_actions %}
        <div class="admin-form__actions">
          <a href="{{ resource_base }}/list{% if return_qs is defined and return_qs %}?{{ return_qs }}{% endif %}" class="btn btn-secondary">{% if admin_edit_btn_cancel %}{{ admin_edit_btn_cancel }}{% endif %}</a>
          <button type="submit" class="btn btn-primary">{% if admin_edit_btn_submit %}{{ admin_edit_btn_submit }}{% endif %}</button>
        </div>
        {% endblock %}
      </form>
    </div>
  </div>
  {% endblock %}
{% endblock %}
{% block extra_js %}
{{ super() }}
  <script {% csp %} src="{{ "js/admin/admin-actions.js" | runique_static }}"></script>
  <script {% csp %} src="{{ "js/admin/checkbox-toggle.js" | runique_static }}"></script>
  <script {% csp %} src="{{ "js/admin/choice-filter.js" | runique_static }}"></script>
{% endblock %}