Opened 19 years ago
Closed 19 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: | no | UI/UX: | no | 
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.
Change History (5)
comment:1 by , 19 years ago
| Summary: | Generic View enhancement → Add a object_detail and object_list generic views that are "based" on a lookup | 
|---|
comment:2 by , 19 years ago
comment:3 by , 19 years ago
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 by , 19 years ago
| Triage Stage: | Unreviewed → 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 by , 19 years ago
| Resolution: | → wontfix | 
|---|---|
| Status: | new → closed | 
This can be done extremely easily by wrapping the generic view, so I'm going to mark this wontfix.
Given that generic views all take a
QuerySetas an argument, isn't this somewhat moot in the case of the list view?