Code

Opened 6 years ago

Closed 20 months 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 6 years ago.
patch against rev 7412 adding orphans support to object_list
misc-orphans-fixes-8147.diff (3.8 KB) - added by shadfc 6 years ago.
orphan support for object_list, and documentation updates for generic views and paginator

Download all attachments as: .zip

Change History (20)

Changed 6 years ago by shadfc

patch against rev 7412 adding orphans support to object_list

comment:1 Changed 6 years ago by anonymous

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset

comment:2 Changed 6 years ago by anonymous

  • Patch needs improvement set

comment:3 Changed 6 years ago by Simon Greenhill

  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 6 years ago by programmerq

  • milestone set to post-1.0

Changed 6 years ago by shadfc

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

comment:5 Changed 6 years ago by shadfc

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to shadfc
  • Patch needs improvement unset
  • Status changed from new to assigned

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

  • Triage Stage changed from Design decision needed to Accepted

comment:7 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:8 Changed 5 years ago by Dzhus

Why this patch still hasn't been accepted upstream?

comment:9 Changed 5 years ago by SmileyChris

  • Needs tests set
  • Triage Stage changed from Accepted to Design 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 4 years ago by russellm

  • Patch needs improvement set
  • Triage Stage changed from Design decision needed to Accepted

Also need to be updated for class-based views.

comment:11 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:12 Changed 3 years ago by Dzhus

  • Cc dima@… added

comment:13 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:14 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:15 Changed 2 years ago by aaugustin

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

comment:16 Changed 23 months ago by anonymous

updated for class based views

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

comment:17 Changed 23 months ago by mjtamlyn

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 20 months ago by Chris Beaven <smileychris@…>

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

In 48e8b5e9446f5f9a0667fccbb0ecbd987a27078b:

Add orphans support to MultipleObjectMixin

Fixes #7005

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.