Opened 9 years ago

Closed 4 years ago

#7005 closed New feature (fixed)

add orphans support for object_list pagination

Reported by: shadfc Owned by: shadfc
Component: Generic views Version: master
Severity: Normal Keywords: orphans object_list paginator
Cc: dima@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

When the new Paginator support was added to the object_list generic view, support for the orphans feature was left out. This could be enabled simply by including the orphans key in the dictionary passed to the view. It would, of course, only be used when the view is paginated.

info_dict = {
    'queryset' : Model.objects.all(),
    'paginate_by' : 10,
    'orphans' : 3,
}

Given this example, up to 13 objects would be included on a page, instead of only a hard limit of 10.

Attachments (2)

object_list-orphans-support.diff (1.0 KB) - added by shadfc 9 years ago.
patch against rev 7412 adding orphans support to object_list
misc-orphans-fixes-8147.diff (3.8 KB) - added by shadfc 8 years ago.
orphan support for object_list, and documentation updates for generic views and paginator

Download all attachments as: .zip

Change History (20)

Changed 9 years ago by shadfc

patch against rev 7412 adding orphans support to object_list

comment:1 Changed 9 years ago by anonymous

Has patch: set
Needs documentation: set
Needs tests: set

comment:2 Changed 9 years ago by anonymous

Patch needs improvement: set

comment:3 Changed 8 years ago by Simon Greenhill

Triage Stage: UnreviewedDesign decision needed

comment:4 Changed 8 years ago by Jeff Anderson

milestone: post-1.0

Changed 8 years ago by shadfc

orphan support for object_list, and documentation updates for generic views and paginator

comment:5 Changed 8 years ago by shadfc

Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to shadfc
Patch needs improvement: unset
Status: newassigned

Added a patch with documentation against rev 8147. This patch adds the orphans support to the object_list generic view and updates the documentation for it. It also updates the paginator documentation to include information about orphans.

I couldn't find any tests regarding object_list to update, and while that's not an excuse...

comment:6 Changed 8 years ago by shadfc

Triage Stage: Design decision neededAccepted

comment:7 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:8 Changed 7 years ago by Dmitry Dzhus

Why this patch still hasn't been accepted upstream?

comment:9 Changed 7 years ago by Chris Beaven

Needs tests: set
Triage Stage: AcceptedDesign decision needed

If you feel passionate about it, feel free to bring it up in the django-dev google group.

A quick review says this looks near ready for checkin if it is considered worthy. My only point would be that for full backwards compatibility, the new argument should be added to the end of the generic view definition. And yeah, no current tests isn't a good excuse ;)

As an aside, the docs in the patch regarding Paginator orphans are good and should be committed either way. If someone was motivated to separate this to a different ticket, that would be good.

comment:10 Changed 6 years ago by Russell Keith-Magee

Patch needs improvement: set
Triage Stage: Design decision neededAccepted

Also need to be updated for class-based views.

comment:11 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:12 Changed 6 years ago by Dmitry Dzhus

Cc: dima@… added

comment:13 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:14 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:15 Changed 5 years ago by Aymeric Augustin

The patch needs to be updated for the class-based generic views.

comment:16 Changed 4 years ago by anonymous

updated for class based views

https://github.com/django/django/pull/270

comment:17 Changed 4 years ago by Marc Tamlyn

Seems to me it may be better to implement this in the context of CBVs as get_paginator_kwargs, a bit like get_form_kwargs rather than a separate method for each variable. Obviously we've got most of them already which we couldn't get rid of without backwards compat, but it's much more future proof.

comment:18 Changed 4 years ago by Chris Beaven <smileychris@…>

Resolution: fixed
Status: assignedclosed

In 48e8b5e9446f5f9a0667fccbb0ecbd987a27078b:

Add orphans support to MultipleObjectMixin

Fixes #7005

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