Skip to content

paginate_by behavior conflicts with ListView #959

Open
@JordanHyatt

Description

@JordanHyatt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions