On part 2 (Databases) of the Django tutorial v1.10, the following line is
given:
{{{>>> Choice.objects.filter(question__pub_date__year=current_year)}}}
However, the variable was created as {{{pub_date__year}}} (not
{{{question__pub_date__year}}}) in a previous section of the same page:
{{{from django.utils import timezone}}}
{{{current_year = timezone.now().year}}}
{{{Question.objects.get(pub_date__year=current_year)}}}
{{{<Question: What's up?>}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27354>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> Bug found here: https://docs.djangoproject.com/en/1.10/intro/tutorial02/
>
> On part 2 (Databases) of the Django tutorial v1.10, the following line is
> given:
>
> {{{>>> Choice.objects.filter(question__pub_date__year=current_year)}}}
>
> However, the variable was created as {{{pub_date__year}}} (not
> {{{question__pub_date__year}}}) in a previous section of the same page:
>
> {{{from django.utils import timezone}}}
> {{{current_year = timezone.now().year}}}
> {{{Question.objects.get(pub_date__year=current_year)}}}
> {{{<Question: What's up?>}}}
New description:
Bug found here: https://docs.djangoproject.com/en/1.10/intro/tutorial02/
On part 2 (Databases) of the Django tutorial v1.10, the following line is
given:
{{{>>> Choice.objects.filter(question__pub_date__year=current_year)}}}
However, the variable was created as {{{pub_date__year}}} (not
{{{question__pub_date__year}}}) in a previous section of the same page:
{{{
# Get the question that was published this year.
>>> from django.utils import timezone
>>> current_year = timezone.now().year
>>> Question.objects.get(pub_date__year=current_year)
<Question: What's up?>
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27354#comment:1>
* status: new => closed
* resolution: => invalid
Comment:
The code is correct. The bit you're referring to isn't a variable, it's
the name of a named argument and it's parsed by the Django ORM to build a
corresponding query.
--
Ticket URL: <https://code.djangoproject.com/ticket/27354#comment:2>