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

{% block content %}
  <div class="module">
    <h3 class="header" id="blue">
      {% trans 'Search options' %}
    </h3>
    <div class="body" id="blue">
      <form method="get" action="/search">
        {% csrf_token %}
        <table>
          {{ form.as_table }}
          <tr>
            <td>&nbsp;</td>
            <td>
              <input type="submit" value="{% trans 'Search' %}">
            </td>
          </tr>
        </table>
      </form>
    </div>
  </div>
  {% if query %}
    <div class="module">
    <h3 class="header" id="blue">
      {% trans 'Results' %}
    </h3>
    <div class="body" id="blue">
      {% for result in page.object_list %}
        <p>
          <a href="{{ result.object.get_absolute_url }}">
          {{ result.object }}
          </a>
        </p>
      {% empty %}
        <p>{% trans 'No results found.' %}</p>
      {% endfor %}
      {% if page.has_previous or page.has_next %}
        <div>
          {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
          |
          {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
        </div>
        </div>
        </div>
      {% endif %}
  {% else %}
    {# Show some example queries to run, maybe query syntax, something else? #}
  {% endif %}
{% endblock %}
