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)

docs-shortcuts.diff (476 bytes ) - added by Masklinn 16 years ago.
Call to list(), to make the returned queryset into one

Download all attachments as: .zip

Change History (3)

by Masklinn, 16 years ago

Attachment: docs-shortcuts.diff added

Call to list(), to make the returned queryset into one

comment:1 by Alex Gaynor, 16 years ago

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:2 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [9857]) Fixed #10298 -- Corrected the example for the get_list_or_404 shortcut. Thanks to Dagur for the report.

Note: See TracTickets for help on using tickets.
Back to Top