diff --git a/sqladmin/pagination.py b/sqladmin/pagination.py index cb6ba562..3e8d122e 100644 --- a/sqladmin/pagination.py +++ b/sqladmin/pagination.py @@ -46,6 +46,11 @@ def next_page(self) -> PageControl: raise RuntimeError("Next page not found.") + def resize(self, page_size: int) -> Pagination: + self.page = (self.page - 1) * self.page_size // page_size + 1 + self.page_size = page_size + return self + def add_pagination_urls(self, base_url: URL) -> None: # Previous pages for p in range(self.page - min(self.max_page_controls, 3), self.page): diff --git a/sqladmin/templates/sqladmin/list.html b/sqladmin/templates/sqladmin/list.html index b141ecb6..cbdb0fae 100644 --- a/sqladmin/templates/sqladmin/list.html +++ b/sqladmin/templates/sqladmin/list.html @@ -198,7 +198,7 @@

{{ model_view.name_plural }}