{% extends "admin/base_site.html" %}
{% load i18n static %}

{% block title %}{{ title }} | {{ site_title }}{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
  <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
  &rsaquo; {{ title }}
</div>
{% endblock %}

{% block content %}
<h1>{{ title }}</h1>

<p class="help">
  {% trans "Execute Django management commands through the web interface. Only superusers can access this feature." %}
</p>

{% if not commands_by_app %}
<p class="errornote">{% trans "No management commands found." %}</p>
{% else %}
  {% for app_label, commands in commands_by_app.items %}
  <div class="module">
    <h2>{{ app_label }}</h2>
    <table>
      <thead>
        <tr>
          <th>{% trans "Command" %}</th>
          <th>{% trans "Description" %}</th>
        </tr>
      </thead>
      <tbody>
        {% for command in commands %}
        <tr>
          <td>
            <a href="{% url 'management_ui:command_form' command.name %}">
              <strong>{{ command.name }}</strong>
            </a>
          </td>
          <td>{{ command.help_text|default:"—"|truncatewords:20 }}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
  {% endfor %}
{% endif %}

{% endblock %}
