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

{% block breadcrumbs %}
<div class="breadcrumbs">
  <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> ›
  <a href="{% url 'admin:app_list' opts.app_label %}">{{ opts.app_config.verbose_name }}</a> ›
  <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a> ›
  {% trans 'Search Email Inboxes' %}
</div>
{% endblock %}

{% block content %}
{% if queryset %}
<p><strong>{% trans 'Selected inboxes' %}:</strong>
  {% for obj in queryset %}{% if not forloop.first %}, {% endif %}{{ obj }}{% endfor %}
</p>
{% endif %}
<form action="" method="post">{% csrf_token %}
  <fieldset class="module aligned">
    {% for field in form %}
      <div class="form-row">
        {{ field.errors }}
        {{ field.label_tag }} {{ field }}
      </div>
    {% endfor %}
    {% for obj in queryset %}
      <input type="hidden" name="_selected_action" value="{{ obj.pk }}">
    {% endfor %}
    <input type="hidden" name="action" value="{{ action }}">
    <input type="hidden" name="apply" value="yes">
  </fieldset>
  <div class="submit-row">
    <input type="submit" class="default" value="{% trans 'Search' %}">
  </div>
</form>

{% if results is not None %}
<h2>{% trans 'Results' %}</h2>
<ul>
  {% for msg in results %}
    <li><strong>{{ msg.subject }}</strong> - {{ msg.from }}<br>{{ msg.body|linebreaksbr }}</li>
  {% empty %}
    <li>{% trans 'No messages found.' %}</li>
  {% endfor %}
</ul>
{% endif %}
{% endblock %}
