Opened 8 years ago

Closed 8 years ago

#27354 closed Bug (invalid)

Incorrect variable name given in tutorial

Reported by: Nick Mow Owned by: nobody
Component: Documentation Version: 1.10
Severity: Normal Keywords: tutorial, 1.10
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Nick Mow)

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

Change History (2)

comment:1 by Nick Mow, 8 years ago

Description: modified (diff)

comment:2 by Aymeric Augustin, 8 years ago

Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top