Search code examples
djangopaginationdjango-tables2

django-tables2 pagination menu too long for mobile and overflowing


I'm using django-tables2 on django2. it works great on desktop browser but when on mobile, the pagination menu on the bottom causes whole tablle to overflow. Basically the menu is just longer than my screen.

I'm using css of DJANGO_TABLES2_TEMPLATE = 'django_tables2/semantic.html'

below is the screenshots.

enter image description here enter image description here

I have tried django-tables2's default paginator, lazy paginator and playing around with per_page.

class ReportListView(SingleTableMixin, FilterView):
    table_class = ReportTable
    template_name = 'report/report_list.html'
    context_object_name = 'reports'
    filterset_class = ReportFilter
    table_pagination = {
        'paginator_class': LazyPaginator,
    }

now it is currently showing 12 buttons on the pagination menu, including left and right arrow. I want paginator menu to be shorter.


Solution

  • After looking through the package files, found out there is a setting for this.

    settings.py
    DJANGO_TABLES2_PAGE_RANGE = 5