Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23855 closed Cleanup/optimization (fixed)

Different usage is different code snippets

Reported by: Will Stott Owned by: nobody
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

https://docs.djangoproject.com/en/1.7/intro/tutorial03/#a-shortcut-render

This snippet uses:

latest_question_list = Question.objects.all().order_by('-pub_date')[:5]

Whereas the previous used:

latest_question_list = Question.objects.order_by('-pub_date')[:5]

There is no explanation.

Change History (3)

comment:1 by Baptiste Mispelon, 10 years ago

Triage Stage: UnreviewedAccepted

Hi,

Good catch, we should use the second version (Question.objects.order_by('-pub_date')[:5]) consistently.

Thanks!

comment:2 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 8fce7978307058f9bc7d9f815858f27fdd954409:

Fixed #23855 -- Removed unnecessary all() in tutorial 3.

comment:3 by Tim Graham <timograham@…>, 10 years ago

In 5a6d6c5e0b70418ef0ead321879c88dc861e5538:

[1.7.x] Fixed #23855 -- Removed unnecessary all() in tutorial 3.

Backport of 8fce7978307058f9bc7d9f815858f27fdd954409 from master

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