2π
β
If you want to disable pagination, then you need to set table_pagination=False
. Setting it to None
means the view uses the default pagination.
class DetailBuildView(SingleTableView):
template_name = 'shoppinglist/detailbuild.html'
table_class = BuildLineTable
table_pagination = False
Instead of setting table_pagination
, you could override get_table_pagination
as follows, but there isnβt any advantage in doing so.
def get_table_pagination(self):
return False
π€Alasdair
1π
Overwrite method paginate(..\django_tables2\tables.py) in YourTable(Table):
The lines that are with #, carry out the pagination, comment them and this is deactivated.
from django.core.paginator import Paginator
def paginate(self, paginator_class=Paginator, per_page=None, page=1, *args, **kwargs):
"""
Paginates the table using a paginator and creates a ``page`` property
containing information for the current page.
Arguments:
paginator_class (`~django.core.paginator.Paginator`): A paginator class to
paginate the results.
per_page (int): Number of records to display on each page.
page (int): Page to display.
Extra arguments are passed to the paginator.
Pagination exceptions (`~django.core.paginator.EmptyPage` and
`~django.core.paginator.PageNotAnInteger`) may be raised from this
method and should be handled by the caller.
"""
#per_page = per_page or self._meta.per_page
#self.paginator = paginator_class(self.rows, per_page, *args, **kwargs)
#self.page = self.paginator.page(page)
return self
π€bryan villa
- [Django]-How can I use django.auth.views.login?
- [Django]-Django Nonrel β Working around multi-table inheritance with noSQL?
- [Django]-NameError: name 'RegexValidator' is not defined
- [Django]-Configuring nginx to drop HTTPS requests with no HTTP HOST header
- [Django]-How to filter django-taggit top tags
Source:stackexchange.com