umbral-admin 0.0.12

Auto-generated CRUD admin UI for umbral models.
Documentation
{% extends "admin/base.html" %}
{% block title %}{{ model.name }} #{{ row[pk] }} — {{ site_title }}{% endblock %}
{% block content %}
  <div class="breadcrumb">
    <a href="{{ admin_base }}">admin</a> / <a href="{{ admin_base }}/{{ model.table }}/">{{ model.name }}</a> / #{{ row[pk] }}
  </div>
  <div class="panel">
    <h2 style="display:flex;align-items:center;justify-content:space-between">
      <span>{{ model.name }} <span class="meta">#{{ row[pk] }}</span></span>
      <span class="actions">
        {% if perms is undefined or perms.can_change %}
        <a class="btn" href="{{ admin_base }}/{{ model.table }}/{{ row[pk] }}/edit">Edit</a>
        {% endif %}
        {% if perms is undefined or perms.can_delete %}
        <form method="post" action="{{ admin_base }}/{{ model.table }}/{{ row[pk] }}/delete" style="display:inline" onsubmit="return confirm('Delete this row? This cannot be undone.')">
          {# Native form POST needs the CSRF token as a field (HTMX gets it from
             the body's hx-headers, but a plain form doesn't). #}
          <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
          <button class="btn btn-danger" type="submit">Delete</button>
        </form>
        {% endif %}
      </span>
    </h2>
    <table>
      <tbody>
        {% for col in model.fields %}
          <tr>
            <th style="width:30%">{{ col.name }}</th>
            <td>{{ row[col.name] }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endblock %}