Created
May 2, 2010 02:14
-
-
Save lukeman/386835 to your computer and use it in GitHub Desktop.
Example of using django-sorting, django-filter and django-pagination together
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load pagination_tags %} | |
{% load sorting_tags %} | |
{% block body %} | |
{% autosort filter.qs as sorted_objects %} | |
{% autopaginate sorted_objects 10 as object_list %} | |
{% for object in object_list %} | |
{{ object }} | |
{% endfor %} | |
{% paginate %} | |
{% endblock %} | |
{% block sidebar %} | |
<div class="filter"> | |
<h2>Sort by</h2> | |
<ul> | |
<li>{% anchor firstfield "First Field" %}</li> | |
<li>{% anchor otherfield "Other Field" %}</li> | |
</ul> | |
<form action="" method="get" class="filter"> | |
{{ filter.form.as_p }} | |
</form> | |
</div> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment