Macro for pagination

This commit is contained in:
2017-06-07 16:43:50 +02:00
parent d3fbc65cdc
commit 0076c9cdb4
4 changed files with 28 additions and 18 deletions

View File

@ -1,4 +1,5 @@
{% extends "core/base.jinja" %}
{% from 'core/macros.jinja' import paginate %}
{% block title %}
{%- trans %}Election list{% endtrans %}
@ -44,5 +45,8 @@
<p>{{ election.description }}</p>
</section>
{%- endfor %}
{% if is_paginated %}
{{ paginate(page_obj, paginator) }}
{% endif %}
{%- endblock %}

View File

@ -164,6 +164,8 @@ class ElectionsListView(CanViewMixin, ListView):
A list with all responsabilities and their candidates
"""
model = Election
ordering = ["-id"]
paginate_by = 10
template_name = 'election/election_list.jinja'