{% extends "admin/change_list.html" %}
{% load i18n admin_urls static admin_list %}


{% if not is_popup %}
  {% block breadcrumbs %}
    <ol class="breadcrumb">
      {% include "admin/partials/_breadcrumb_home.html" %}
      
      <li>
        <a href="{% url 'admin:index' %}">
          {% trans 'Admin' %}
        </a>
      </li>
      
      <li>
        <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">
          {{ cl.opts.app_config.verbose_name }}
        </a>
      </li>
      
      <li class="active">
        {{ cl.opts.verbose_name_plural|capfirst }}
      </li>
    </ol>
  {% endblock breadcrumbs %}
{% endif %}


{% block object-tools %}
  <div class="row">
    <ul class="object-tools">
      {% block object-tools-items %}
        
        {% if has_add_permission %}
          <li>
            {% url cl.opts|admin_urlname:'add' as add_url %}
            <a href="{% add_preserved_filters add_url is_popup to_field %}" class="btn btn-primary btn-sm">
              <i class="fa fa-plus"></i>
              {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
            </a>
          </li>
        {% endif %}
        
      {% endblock object-tools-items %}
    </ul>
  </div>
{% endblock object-tools %}


{% block content %}
  <div id="content-main">

    {% if cl.formset.errors %}
      <p class="errornote">
        {% if cl.formset.total_error_count == 1 %}
          {% trans "Please correct the error below." %}
        {% else %}
          {% trans "Please correct the errors below." %}
        {% endif %}
      </p>
      {{ cl.formset.non_form_errors }}
    {% endif %}

    <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
      <div class="changelist-form-container">
        {% block search %}
          {% search_form cl %}
        {% endblock search %}

        {% block date_hierarchy %}
          {% date_hierarchy cl %}
        {% endblock date_hierarchy %}

        <form id="changelist-form" method="post"{% if cl.formset.is_multipart %}
          enctype="multipart/form-data"{% endif %} novalidate>
          {% csrf_token %}
        
          {% if cl.formset %}
            <div>{{ cl.formset.management_form }}</div>
          {% endif %}

          {% block result_list %}
            {% if action_form and actions_on_top and cl.show_admin_actions %}
              {% admin_actions %}
            {% endif %}
            
            {% result_list cl %}
            
            {% if action_form and actions_on_bottom and cl.show_admin_actions %}
              {% admin_actions %}
            {% endif %}
          {% endblock result_list %}

          {% block pagination %}
            {% pagination cl %}
          {% endblock pagination %}
        </form>
      
      </div>
    
      {% block filters %}
        {% if cl.has_filters %}
          {% comment %}
            L8R: position:absolute (default) causes long filters to be cut off at
            the bottom. Overriding to initial, with float: right fixes that, but
            makes the filter list appear below the search bar and date drilldown.
          {% endcomment %}
          
          <div id="changelist-filter" style="position: initial; float: right;">
            <h2>{% trans 'Filter' %}</h2>
            {% for spec in cl.filter_specs %}
              {% admin_list_filter cl spec %}
            {% endfor %}
          </div>
        {% endif %}
      {% endblock filters %}
    
      <div class="clearfix"></div>
    
    </div>
  </div>
{% endblock content %}
