{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{% translate 'Models' %}{% endblock %}
{% block main %}
  <section class="section">
    <div class="container">
      <h1 class="title">{% translate 'Model documentation' %}</h1>
      <nav class="breadcrumb">
	<ul>
	  <li><a href="/admin/">首页</a></li>
	  <li><a href="{% url 'django-admindocs-docroot' %}">文档</a></li>
	  <li class="is-active"><a href="#" aria-current="page">模型</a></li>
	</ul>
      </nav>
      <div class="content has-background-light p-3">
	<h4>{% translate 'Model groups' %}</h4>
	<ol>
	  {% regroup models by app_config as grouped_models %}
	  {% for group in grouped_models %}
	    <li><a href="#app-{{ group.grouper.label }}">{{ group.grouper.verbose_name  }}</a></li>
	  {% endfor %}
	</ol>
      </div>

      {% regroup models by app_config as grouped_models %}

      <div>
	{% for group in grouped_models %}
	  <div class="content">
	    <h4 id="app-{{ group.grouper.label }}">{{ group.grouper.verbose_name }} ({{ group.grouper.name }})</h4>

	    <table class="table is-fullwidth is-bordered is-hoverable">
	      {% for model in group.list %}
		<tr>
		  <th><a href="{% url 'django-admindocs-models-detail' app_label=model.app_label model_name=model.model_name %}">{{ model.object_name }}</a></th>
		</tr>
	      {% endfor %}
	    </table>
	  </div>
	{% endfor %}

      </div>
    </div>
  </section>
{% endblock %}
