Code

Opened 8 years ago

Closed 7 years ago

#1982 closed enhancement (wontfix)

Add a object_detail and object_list generic views that are "based" on a lookup

Reported by: EspenG Owned by: jacob
Component: Generic views Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I was thinking, would it not be nice if there was a function like django.views.generic.list_detail.object_list that takes and argument like an id or a slug like django.views.generic.list_detail.object_detail does. An actual use of this would be when you want to show all the blog items that is marked with a spesific tag.

Attachments (0)

Change History (5)

comment:1 Changed 8 years ago by adrian

  • Summary changed from Generic View enhancement to Add a object_detail and object_list generic views that are "based" on a lookup

comment:2 Changed 8 years ago by ubernostrum

Given that generic views all take a QuerySet as an argument, isn't this somewhat moot in the case of the list view?

comment:3 Changed 8 years ago by anonymous

I don't think you can construct the base queryset
with a 'id' you are passing in the URL itself.

eg.. show me all the invoices for customer 5.

personally I find I do a lot of these kind of views.

comment:4 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Triage Stage changed from Unreviewed to Design decision needed

You could have your own view that calls the object_list generic view, passing it a queryset that does the filter you are wanting.

comment:5 Changed 7 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from new to closed

This can be done extremely easily by wrapping the generic view, so I'm going to mark this wontfix.

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.