Opened 17 years ago

Closed 12 years ago

#7005 closed New feature (fixed)

add orphans support for object_list pagination

Reported by: shadfc Owned by: shadfc
Component: Generic views Version: dev
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 17 years ago.
patch against rev 7412 adding orphans support to object_list
misc-orphans-fixes-8147.diff (3.8 KB ) - added by shadfc 16 years ago.
orphan support for object_list, and documentation updates for generic views and paginator

Download all attachments as: .zip

Change History (20)

by shadfc, 17 years ago

patch against rev 7412 adding orphans support to object_list

comment:1 by anonymous, 17 years ago

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

comment:2 by anonymous, 17 years ago

Patch needs improvement: set

comment:3 by Simon Greenhill, 17 years ago

Triage Stage: UnreviewedDesign decision needed

comment:4 by Jeff Anderson, 16 years ago

milestone: post-1.0

by shadfc, 16 years ago

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

comment:5 by shadfc, 16 years ago

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 by shadfc, 16 years ago

Triage Stage: Design decision neededAccepted

comment:7 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:8 by Dmitry Dzhus, 15 years ago

Why this patch still hasn't been accepted upstream?

comment:9 by Chris Beaven, 15 years ago

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 by Russell Keith-Magee, 14 years ago

Patch needs improvement: set
Triage Stage: Design decision neededAccepted

Also need to be updated for class-based views.

comment:11 by Julien Phalip, 14 years ago

Severity: Normal
Type: New feature

comment:12 by Dmitry Dzhus, 14 years ago

Cc: dima@… added

comment:13 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:14 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:15 by Aymeric Augustin, 13 years ago

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

comment:16 by anonymous, 12 years ago

updated for class based views

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

comment:17 by Marc Tamlyn, 12 years ago

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 by Chris Beaven <smileychris@…>, 12 years ago

Resolution: fixed
Status: assignedclosed

In 48e8b5e9446f5f9a0667fccbb0ecbd987a27078b:

Add orphans support to MultipleObjectMixin

Fixes #7005

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