#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 , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Hi,
Good catch, we should use the second version (
Question.objects.order_by('-pub_date')[:5]
) consistently.Thanks!