Opened 13 years ago

Closed 13 years ago

Last modified 12 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: dev
Severity: Keywords: blocker
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

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@… 13 years ago.
is_paginated.2.diff (1.3 KB ) - added by Ivan Virabyan 13 years ago.
patch was improved, test added

Download all attachments as: .zip

Change History (6)

by i.virabyan@…, 13 years ago

Attachment: is_paginated.diff added

comment:1 by Russell Keith-Magee, 13 years ago

Keywords: blocker added
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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 by Ivan Virabyan, 13 years ago

Owner: changed from nobody to Ivan Virabyan
Status: newassigned

by Ivan Virabyan, 13 years ago

Attachment: is_paginated.2.diff added

patch was improved, test added

comment:3 by Russell Keith-Magee, 13 years ago

Resolution: fixed
Status: assignedclosed

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 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

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