#18189 closed Bug (invalid)
Missing a .all() in Tutorial 4
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the section use generic views: Less code is better
in the Change it like so:
What there currently is as of 4/22/12 is as follows:
queryset=Poll.objects.order_by('-pub_date')[:5],
I believe you meant this:
queryset=Poll.objects.all().order_by('-pub_date')[:5],
Change History (6)
comment:1 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 13 years ago
Well,
until I did that, I didn't get any results back when I went to the polls URL.
Plus it doesn't really follow the syntax on the Tutorial Page 3.
-Peter
comment:3 by , 13 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Btw,
I'm running django 1.4.
Based on your comment, it appears you shouldn't have to do this .all() for it to work.
I'm curious dd you actually try this and what version of django/python is this supposed to work?
-Peter
comment:4 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
The all() has never, at any point in Django's history been required here.
comment:5 by , 13 years ago
Alex,
Roger.
If I understand you correctly, then, if I remove the .all() like in the original
tutorial, and it doesn't return anything, but then put it back
and it does return something... do you have any thoughts on what the problem
could be?
Then I would suggest for consistency sake, you should consider remove the .all()
from the examples in part 3 of the tutorial, however,
I would humbly recommend testing it 1st. (which is how I managed to solve not
getting results back).
When I come home tonight, I can do that to see if it has similar effects on the
query results like I'm currently getting.
Of course, based on the feedback I've seen from this submission, it appears like
it is a localized problem with my setup
and not the norm.
I'm using sqlite3 for db backend when going through the tutorial. I'm wondering
if that has any bearing on this.
Or could it be the python version I'm using?
Regards,
-Peter
comment:6 by , 13 years ago
Update,
looks like it was probably a typo or operator error. I can't seem to be able to reproduce it. It appears to work both with and without the .all().
-Peter
The .all() can be implied in this context; it isn't required.