Code

Opened 7 years ago

Closed 7 years ago

#5206 closed (invalid)

next / previous object container tags within queryset

Reported by: drackett@… Owned by: adrian
Component: Template system Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I think it would be a good to be able to get the next or previous item within a given queryset instead of just within the current model.

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Querysets satisfy the iterator protocol and the elements come out in the order you specify in the query. So you can already do this (if you really need to go backwards, you'd have to capture the previous results along the way, or else convert the queryset to a list, but both of those are easy).

If you have questions about how to accomplish things like this, ask on the django-users list.

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.