Browse Source

Finaliza a correcao da paginaçao

pull/282/head
Eduardo Calil 9 years ago
parent
commit
b36b07a003
  1. 7
      materia/views.py
  2. 34
      templates/paginacao_pesquisa_materia.html

7
materia/views.py

@ -1248,9 +1248,12 @@ class MateriaLegislativaPesquisaView(FilterView):
self.object_list = self.filterset.qs
if (data and data.get('numero') is not None):
url = str(self.request.environ['QUERY_STRING'])
url = "&"+str(self.request.environ['QUERY_STRING'])
if url[:5] == "&page":
ponto_comeco = url.find('numero=') - 1
url = url[ponto_comeco:]
else:
url = None
url = ''
context = self.get_context_data(filter=self.filterset,
object_list=self.object_list,

34
templates/paginacao_pesquisa_materia.html

@ -3,23 +3,11 @@
<nav class="text-center">
<ul class="pagination">
{% if page_obj.has_previous %}
{% if filter_url %}
<li class="page-item">
<a class="page-link" href="?page={{page_obj.previous_page_number}}">
<a class="page-link" href="?page={{page_obj.previous_page_number}}{{filter_url}}">
<span class="pager-prev">Anterior</span>
</a>
</li>
{% else %}
<li class="page-item">
<a class="page-link" href="?{{filter_url}}">
<span class="pager-prev">Anterior</span>
</a>
</li>
{% endif %}
{% else %}
<li class="pager-prev disabled"><a href="">Anterior</a></li>
{% endif %}
@ -30,36 +18,18 @@
<a class="page-link" href="">...</a>
</li>
{% else %}
{% if filter_url %}
<li {% if page == page_obj.number %} class="page-item active" {% endif %}>
<a class="page-link" href="?{{filter_url}}">{{ page }}</a>
</li>
{% else %}
<li {% if page == page_obj.number %} class="page-item active" {% endif %}>
<a class="page-link" href="?page={{ page }}">{{ page }}</a>
<a class="page-link" href="?page={{page}}{{filter_url}}">{{ page }}</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
{% if filter_url %}
<li class="page-item">
<a class="page-link" href="?page={{page_obj.next_page_number}}{{filter_url}}">
<span class="pager-next">Próxima</span>
</a>
</li>
{% else %}
<li class="page-item">
<a class="page-link" href="?page={{page_obj.next_page_number}}{{filter_url}}">
<span class="pager-next">Próxima</span>
</a>
</li>
{% endif %}
{% else %}
<li class="pager-next disabled"><a href="">Próxima</a></li>
{% endif %}

Loading…
Cancel
Save