search.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <h2>Search</h2>
  4. <form method="get" action=".">
  5. <table>
  6. {{ form.as_table }}
  7. <tr>
  8. <td>&nbsp;</td>
  9. <td>
  10. <input type="submit" value="Search">
  11. </td>
  12. </tr>
  13. </table>
  14. {% if query %}
  15. <h3>Results</h3>
  16. {% for result in page.object_list %}
  17. <p>
  18. <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a>
  19. </p>
  20. {% empty %}
  21. <p>No results found.</p>
  22. {% endfor %}
  23. {% if page.has_previous or page.has_next %}
  24. <div>
  25. {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
  26. |
  27. {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
  28. </div>
  29. {% endif %}
  30. {% else %}
  31. {# Show some example queries to run, maybe query syntax, something else? #}
  32. {% endif %}
  33. </form>
  34. {% endblock %}