Browse Source

Add pagination on comissao_list

pull/6/head
Eduardo Edson Batista Cordeiro Alves 10 years ago
parent
commit
4a84ecab76
  1. 1
      sapl/crud.py
  2. 32
      templates/comissoes/comissao_list.html

1
sapl/crud.py

@ -65,6 +65,7 @@ def build_crud(model, *layout):
class CrudListView(BaseMixin, ListView):
title = BaseMixin.verbose_name_plural
paginate_by = 10
class CrudCreateView(BaseMixin, FormMessagesMixin, CreateView):
form_class = crud.model_form

32
templates/comissoes/comissao_list.html

@ -29,4 +29,36 @@
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<nav class="pagination-centered">
<ul class="pagination">
{% if page_obj.has_previous %}
<li>
<a href="?page={{ page_obj.previous_page_number }}">
<span class="arrow">&laquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable"><a href="">&laquo;</a></li>
{% endif %}
{% for page in paginator.page_range %}
<li {% if page == page_obj.number %}class="active current"{% endif %}>
<a href="?page={{ page }}">{{ page }}</a>
</li>
{% endfor %}
{% if page_obj.has_next %}
<li>
<a href="?page={{ page_obj.next_page_number }}">
<span class="arrow">&raquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable"><a href="">&raquo;</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endblock %}

Loading…
Cancel
Save