{% extends "base.html" %}
{% load generic %}
{% load core %}
{% load i18n %}

{% block main-menu %}
  {{ block.super }}
  {% pure_genericmodel_content_types as content_types %}
  {% any_view_permission content_types as anyperm %}
  {% if anyperm %}
    <li class="nav-item dropdown">
      <a href="#"
         class="nav-link dropdown-toggle"
         data-bs-toggle="dropdown"
         role="button"
         aria-haspopup="true"
         aria-expanded="false">
        {% translate "Other models" %}
        <span class="caret" />
      </a>
      <div class="dropdown-menu" aria-labelledby="navbarDropdown">
        {% for content_type in content_types %}
          {% if content_type.model_class.get_view_permission in perms %}
            {% with content_type.model_class|opts as meta %}
              <a class="dropdown-item"
                 href="{{ content_type.model_class.get_listview_url }}">{{ meta.verbose_name_plural|capfirst }}</a>
            {% endwith %}
          {% endif %}
        {% endfor %}
      </div>
    </li>
  {% endif %}
{% endblock main-menu %}
