Django page with Class Based Views

Asked

Viewed 18 times

0

Hello, I have a problem with paging in Django, using Class Based View. Below are the code snippets:

py views.

class ExtratoListView(LoginRequiredMixin, SingleTableMixin, FilterView):
model = Extrato
table_class = ExtratoListaTable
template_name = 'anviva/extrato.html'
filterset_class = ExtratoListFilter
paginate_by = 10

html

<div class="pagination">
<span class="step-links">
    {% if page_obj.has_previous %}
        <a href="?page={{ page_obj.previous_page_number }}">anterior</a>
    {% endif %}

    <span class="current">
        ( Página {{ page_obj.number }} de {{ page_obj.paginator.num_pages }} )
    </span>

    {% if page_obj.has_next %}
        <a href="?page={{ page_obj.next_page_number }}">próximo</a>
    {% endif %}
</span>
{% render_table table 'django_tables2/bootstrap.html' %}

This code generates a list with the extract, and uses a filter. Paging works. But when I enter a value in the filter, a date for example, the paging does not work. It Zera the filter, showing all the records. I can’t seem to solve.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.