From 99315f709e26ea80de8ea3af4e336dbdbe467711 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 8 Jan 2013 15:43:35 -0500 Subject: [PATCH] Fixed #19555 - Removed '2012' from tutorial 1. Thanks rodrigorosa.lg and others for the report. --- docs/intro/tutorial01.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index d24e19ce11..cd07e081fc 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -647,8 +647,10 @@ Save these changes and start a new Python interactive shell by running >>> Poll.objects.filter(question__startswith='What') [] - # 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) # Request an ID that doesn't exist, this will raise an exception. @@ -699,8 +701,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) [, , ] # Let's delete one of the choices. Use delete() for that.