diff --git a/django_tables2/views.py b/django_tables2/views.py index 841bf901..356f7b75 100644 --- a/django_tables2/views.py +++ b/django_tables2/views.py @@ -41,7 +41,7 @@ def get_table_pagination(self, table): paginate = {} # Obtains and set page size from get_paginate_by - paginate_by = self.get_paginate_by(table.data) + paginate_by = self.get_paginate_by(table.data) or self.get_paginate_table_by(table.data) if paginate_by is not None: paginate["per_page"] = paginate_by @@ -73,6 +73,18 @@ def get_paginate_by(self, table_data) -> Optional[int]: """ return getattr(self, "paginate_by", None) + def get_paginate_table_by(self, table_data) -> Optional[int]: + """ + Alternate method for setting paginate_by that does not conflict with ListView + + Args: + table_data: The table's data. + + Returns: + Optional[int]: Items per page or ``None`` for no pagination. + """ + return getattr(self, "paginate_table_by", None) + class SingleTableMixin(TableMixinBase): """