batiste/django-page-cms

View on GitHub
pages/templates/search/search.html

Summary

Maintainability
Test Coverage
{% extends 'pages/examples/index.html' %}

{% block content %}

    <form method="get" action=".">
        <table>
            {{ form.as_table }}
            <tr>
                <td>&nbsp;</td>
                <td>
                    <input type="submit" value="Search">
                </td>
            </tr>
        </table>

        {% if query %}
            <h3>Search results</h3>

            {% for result in page.object_list %}
                <p>
                    <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a>
                </p>
            {% empty %}
                <p>No results found. Did you build the search index? (python manage.py rebuild_index)</p>
            {% endfor %}
        {% else %}
            {# Show some example queries to run, maybe query syntax, something else? #}
        {% endif %}
    </form>
{% endblock %}