summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-01-08 15:43:35 -0500
committerTim Graham <timograham@gmail.com>2013-01-17 16:41:05 -0500
commit89ba1b27b4442cbb43555f607ab7d0f189a2af50 (patch)
tree7a2cb2e8312212e25a55aa59e6d1ff257f5b7c34 /docs
parentc26541f5cb0f069ff9562fa34d8408e69f9976e8 (diff)
[1.4.x] Fixed #19555 - Removed '2012' from tutorial 1.
Thanks rodrigorosa.lg and others for the report. Backport of 99315f709e from master
Diffstat (limited to 'docs')
-rw-r--r--docs/intro/tutorial01.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index d37564055e..c9b9af35f6 100644
--- a/docs/intro/tutorial01.txt
+++ b/docs/intro/tutorial01.txt
@@ -658,8 +658,10 @@ Save these changes and start a new Python interactive shell by running
>>> Poll.objects.filter(question__startswith='What')
[<Poll: What's up?>]
- # Get the poll whose year is 2012.
- >>> Poll.objects.get(pub_date__year=2012)
+ # Get the poll that was published this year.
+ >>> from django.utils import timezone
+ >>> current_year = timezone.now().year
+ >>> Poll.objects.get(pub_date__year=current_year)
<Poll: What's up?>
>>> Poll.objects.get(id=2)
@@ -709,8 +711,9 @@ Save these changes and start a new Python interactive shell by running
# The API automatically follows relationships as far as you need.
# Use double underscores to separate relationships.
# This works as many levels deep as you want; there's no limit.
- # Find all Choices for any poll whose pub_date is in 2012.
- >>> Choice.objects.filter(poll__pub_date__year=2012)
+ # Find all Choices for any poll whose pub_date is in this year
+ # (reusing the 'current_year' variable we created above).
+ >>> Choice.objects.filter(poll__pub_date__year=current_year)
[<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]
# Let's delete one of the choices. Use delete() for that.