Opened 11 years ago

Closed 11 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


The documentation needs to be fixed (

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 11 years ago.
Call to list(), to make the returned queryset into one

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Masklinn

Attachment: docs-shortcuts.diff added

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

comment:1 Changed 11 years ago by Alex Gaynor

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 11 years ago by Russell Keith-Magee

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