[Django] #27354: Incorrect variable name given in tutorial

4 views
Skip to first unread message

Django

unread,
Oct 16, 2016, 1:26:19 PM10/16/16
to django-...@googlegroups.com
#27354: Incorrect variable name given in tutorial
-------------------------------+----------------------------
Reporter: arcanemachine | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.10
Severity: Normal | Keywords: tutorial, 1.10
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+----------------------------
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?>}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27354>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 16, 2016, 1:27:46 PM10/16/16
to django-...@googlegroups.com
#27354: Incorrect variable name given in tutorial
--------------------------------+--------------------------------------

Reporter: arcanemachine | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.10
Severity: Normal | Resolution:

Keywords: tutorial, 1.10 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by arcanemachine):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> 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:


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>

Django

unread,
Oct 16, 2016, 2:57:21 PM10/16/16
to django-...@googlegroups.com
#27354: Incorrect variable name given in tutorial
--------------------------------+--------------------------------------
Reporter: arcanemachine | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.10
Severity: Normal | Resolution: invalid

Keywords: tutorial, 1.10 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Aymeric Augustin):

* 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>

Reply all
Reply to author
Forward
0 new messages