Skip to content

Instantly share code, notes, and snippets.

@ikks
Created February 11, 2012 00:09
Show Gist options
  • Save ikks/1794276 to your computer and use it in GitHub Desktop.
Save ikks/1794276 to your computer and use it in GitHub Desktop.
Sample for a search template using gist
{% extends "layout/base.html" %}
<div class="entry">
{% block body %}
<div class="register_init">
<div class="add_new">
<a href="/recolecta/nuevo">Nueva Solicitud de Inscripción en el Registro</a>
</div>
<form method="get" action=".">
{{ form.as_p }}
<input type="submit" value="Buscar">
</form>
{% if query %}
<h3>Resultados</h3>
{% for result in page.object_list %}
<p>
<a href="/recolecta/1/{{ result.object.id }}">{{ result.object.assignednumber }}</a>: {{ result.object }}
</p>
{% empty %}
<p>No se encontraron resultados.</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>
{% endif %}
{% else %}
{# Show some example queries to run, maybe query syntax, something else? #}
{% endif %}
</div>
{% endblock %}
</div>
{% block search %}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment