{% extends "admin/models/base.html" %}

{% block breadcrumbs %}
 {{ super() }}
 <li><span class="divider">/</span> <a href=".">Delete</a></li>
{% endblock %}

{% block extra_tabs %}
   <li class="active"><a href=".">Delete</a></li>
{% endblock %}

{% block content %}
  <form action="." class="form-horizontal" method="post">
    {% for object in query %}<input type="hidden" name="id" value="{{ object.get_id() }}" />{% endfor %}
    <fieldset>
      {% if csrf_token %}{# Support for flask-seasurf #}<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">{% endif %}
      <legend>Confirm delete</legend>
      <ul>
        {% for object in query %}
          <li>
            {% if get_admin_url(object) %}
              <a href="{{ get_admin_url(object) }}">{{ object }}</a>
            {% else %}
              <span>{{ object }}</span>
            {% endif %}
            {% if collected and object.get_id() in collected %}
              <ul>
                {% for depth, model, collected_objects in collected[object.get_id()] %}
                  {% for sub_object in collected_objects %}
                    <li><span>{{ get_model_name(model) }}:</span>
                      {% if get_admin_url(sub_object) %}
                        <a href="{{ get_admin_url(sub_object) }}">{{ sub_object }}</a>
                      {% else %}
                        <span>{{ sub_object }}</span>
                      {% endif %}
                    </li>
                  {% endfor %}
                {% endfor %}
              </ul>
            {% endif %}
          </li>
        {% endfor %}
      </ul>
      
      <div class="form-actions">
        <button class="btn btn-danger" type="submit">Confirm Delete</button>
        <a class="btn" href="{{ url_for(model_admin.get_url_name('index')) }}">Cancel</a>
      </div>
    </fieldset>
  </form>
{% endblock %}
