Revised the pagination to redirect to the URL without the page number if the specific page number is exactly the default page number. That is, the page number is totally unnecessary.
This commit is contained in:
parent
789bdca699
commit
3abce4498f
@ -66,9 +66,12 @@ class Pagination:
|
|||||||
if page_size is not None \
|
if page_size is not None \
|
||||||
else self.DEFAULT_PAGE_SIZE
|
else self.DEFAULT_PAGE_SIZE
|
||||||
total_pages = int((count - 1) / self.page_size) + 1
|
total_pages = int((count - 1) / self.page_size) + 1
|
||||||
|
default_page = 1 if not is_reverse else total_pages
|
||||||
|
if page_no == default_page:
|
||||||
|
raise PageNoOutOfRangeError()
|
||||||
self.page_no = page_no \
|
self.page_no = page_no \
|
||||||
if page_no is not None \
|
if page_no is not None \
|
||||||
else 1 if not is_reverse else total_pages
|
else default_page
|
||||||
if self.page_no > total_pages:
|
if self.page_no > total_pages:
|
||||||
raise PageNoOutOfRangeError()
|
raise PageNoOutOfRangeError()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user