-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to django-tables2 1.2.6's pagination footer behavior, which in…
…cludes a 'cardinality' section detailing item counts
- Loading branch information
1 parent
d8025b5
commit fad8747
Showing
8 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{# vim: set syntax=htmldjango: #} | ||
{% extends "django_tables2/table.html" %} | ||
{% comment %} | ||
django-tables 1.2.7 introduced some changes to their pagination | ||
footer which I wasn't fond of (specifically they got rid of the | ||
"X of Y item(s)" text). This custom template just overrides that | ||
block to revert back to 1.2.6 behavior. | ||
Since I want to implement a pagination system which lets you go | ||
directly to various page numbers anyway, it'll be nice to have | ||
this in place... | ||
{% endcomment %} | ||
{% load django_tables2 %} | ||
{% load i18n %} | ||
|
||
{% block pagination %} | ||
<ul class="pagination"> | ||
{% if table.page.has_previous %} | ||
{% block pagination.previous %} | ||
<li class="previous"> | ||
<a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}">{% trans "Previous" %}</a> | ||
</li> | ||
{% endblock pagination.previous %} | ||
{% endif %} | ||
|
||
{% if table.page.has_previous or table.page.has_next %} | ||
{% block pagination.current %} | ||
<li class="current"> | ||
{% blocktrans with table.page.number as current and table.paginator.num_pages as total %}Page {{ current }} of {{ total }}{% endblocktrans %} | ||
</li> | ||
{% endblock pagination.current %} | ||
{% endif %} | ||
|
||
{% if table.page.has_next %} | ||
{% block pagination.next %} | ||
<li class="next"> | ||
<a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}">{% trans "Next" %}</a> | ||
</li> | ||
{% endblock pagination.next %} | ||
{% endif %} | ||
{% block pagination.cardinality %} | ||
<li class="cardinality"> | ||
{% if total != count %}{% blocktrans %}{{ count }} of {{ total }}{% endblocktrans %}{% else %}{{ total }}{% endif %} {% if total == 1 %}{{ table.data.verbose_name }}{% else %}{{ table.data.verbose_name_plural }}{% endif %} | ||
</li> | ||
{% endblock pagination.cardinality %} | ||
</ul> | ||
{% endblock pagination %} |