Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15575 closed (fixed)

MultipleObjectMixin.paginate_queryset always returns is_paginated=True

Reported by: i.virabyan@… Owned by: ivan_virabyan
Component: Generic views Version: master
Severity: Keywords: blocker
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: UI/UX:


Documentation says:

is_paginated: A boolean representing whether the results are paginated. Specifically ... if the available objects do not span multiple pages.

But is_paginated is True even when objects do not span multiple pages.

def paginate_queryset(self, queryset, page_size):
    return (paginator, page, page.object_list, True)

As you can see, it always sets the last element of tuple to True, which is value for is_paginated.

Attachments (2)

is_paginated.diff (675 bytes) - added by i.virabyan@… 5 years ago.
is_paginated.2.diff (1.3 KB) - added by ivan_virabyan 5 years ago.
patch was improved, test added

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by i.virabyan@…

comment:1 Changed 5 years ago by russellm

  • Keywords blocker added
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

Following the lead from the old list_detail views, the check should actually be page_obj.has_other_pages(), not just num_pages > 1.

This is a bug in a new feature, so it needs to be addressed before 1.3 final.

comment:2 Changed 5 years ago by ivan_virabyan

  • Owner changed from nobody to ivan_virabyan
  • Status changed from new to assigned

Changed 5 years ago by ivan_virabyan

patch was improved, test added

comment:3 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from assigned to closed

In [15820]:

Fixed #15575 -- Corrected handling of pagination in generic views to match documentation and historical behavior. Thanks to Ivan Virabyan for the report and patch.

comment:4 Changed 5 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top