Opened 8 years ago

Closed 8 years ago

#10298 closed (fixed)

get_list_or_404 documentation

Reported by: Dagur 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: UI/UX:


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

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by masklinn

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

comment:1 Changed 8 years ago by Alex

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 8 years ago by russellm

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

(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