Задать вопрос

Тел: +7 965 3737 888

609

Просмотров

0

Ответов

Digg-like pagination

<p>My take on digg-like pagination.</p>
<p>Save the code as 'templatetags/pagination_nav.py' in one of your apps.</p>
<p>It relies on a 'pagination_nav.html' template. Here is a base template:</p>
{% if pages %}
&lt;div class="bottom-pagination-nav"&gt;
{% if previous_url %}&lt;a href="{{ previous_url }}"&gt;{% else %}&lt;span&gt;{% endif %}&amp;laquo; Previous{% if previous_url %}&lt;/a&gt;{% else %}&lt;/span&gt;{% endif %}
{% for group in pages %}
{% for page in group %}
{% if page.current %}&lt;span&gt;{{ page.number }}&lt;/span&gt;{% else %}&lt;a href="{{ page.url }}"&gt;{{ page.number }}&lt;/a&gt;{% endif %}
{% endfor %}
{% if not forloop.last %}&lt;span&gt;...&lt;/span&gt;{% endif %}
{% endfor %}
{% if next_url %}&lt;a href="{{ next_url }}"&gt;{% else %}&lt;span&gt;{% endif %}Next &amp;raquo;{% if next_url %}&lt;/a&gt;{% else %}&lt;/span&gt;{% endif %}
&lt;/div&gt;
{% endif %}

Вопрос полезен? Да0/Нет0
file_3947.py(4.0Кб)
None