Opened 16 years ago
Closed 16 years ago
#10298 closed (fixed)
get_list_or_404 documentation
Reported by: | Dagur Páll Ammendrup | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation needs to be fixed (http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#get-list-or-404)
get_list_or_404 is not equivalent to doing:
def my_view(request): my_objects = MyModel.objects.filter(published=True) if not my_objects: raise Http404
because my_objects is a queryset but the function will return a list.
Attachments (1)
Change History (3)
by , 16 years ago
Attachment: | docs-shortcuts.diff added |
---|
comment:1 by , 16 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
comment:2 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Call to list(), to make the returned queryset into one