Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paginate_by behavior conflicts with ListView #959

Open
JordanHyatt opened this issue Sep 18, 2024 · 0 comments
Open

paginate_by behavior conflicts with ListView #959

JordanHyatt opened this issue Sep 18, 2024 · 0 comments

Comments

@JordanHyatt
Copy link
Contributor

JordanHyatt commented Sep 18, 2024

TableMixin and ListView both use the class variable paginate_by (and get_paginate_by method) to set the Pagintor.per_page attribute. However they have divergent behavior on handling pages that are out of bounds as well as when paginate_by is not set.

if  paginate_by  is NOT set:
    ListView:   Does not attempt to paginate
    TableMixin:  Uses a default of 25
     
    if  page is "out of bounds":
         ListView: Does nothing since it is not attempting to paginate
         TableMixin:  Handles it gracfully and takes you to the last page instead
         
if paginate_by IS set:
   ListView:  Attempts Pagination
   TableMixin:  Also Attempts Pagination
   
    if the page is "out of bounds":
          ListView:  Throws 404 error because of the empty page
          TableMixin:  Has no chance to handle gracefully because list view already threw 404 error

This cannot be the intended behavior, to have "out of bounds" pages handled differently depending on whether or not paginate_by was set.

Recommendation:
allow for a new name space. paginate_table_by and get_paginate_table_by that allows for the user to set per_page and continue to let TableMixin handle out of bounds pages gracefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant