view gpp/templates/search/search.html @ 219:26ee684c2033

Initial commit of Haystack search integration. See #51.
author Brian Neal <bgneal@gmail.com>
date Sat, 05 Jun 2010 20:46:52 +0000
parents
children 71fd8454688b
line wrap: on
line source
{% extends 'base.html' %}
{% load highlight %}
{% block title %}Search{% endblock %}
{% block content %}
<h2>Search <img src="{{ MEDIA_URL }}icons/magnifier.png" alt="Search" /></h2>
<form method="get" action=".">
  <table>
      {{ form.as_table }}
      <tr>
          <td>&nbsp;</td>
          <td>
              <input type="submit" value="Search">
          </td>
      </tr>
  </table>
  {% if query %}
      <h3>Results</h3>
      {% if page.object_list %}
      <dl>
      {% for result in page.object_list %}
         <dt>
            {{ result.verbose_name }}: {{ result.title|safe }} &bull; {{ result.score }}
         </dt>
         <dd>
            {% highlight result.summary with query css_class "highlight" max_length 200 %}
         </dd>
      {% endfor %}
      </dl>
      {% endif %}

      {% 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>
      {% endif %}
  {% else %}
      {# Show some example queries to run, maybe query syntax, something else? #}
  {% endif %}
</form>
{% endblock %}