Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28568 closed Uncategorized (fixed)

Example in reference of Database Functions leads to NameError

Reported by: Michael Käufl Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following example (just above https://docs.djangoproject.com/en/1.11/ref/models/database-functions/#trunc) leads to a NameError, because melb is not defined.

>>> import pytz
>>> tzinfo = pytz.timezone('Australia/Melbourne')
>>> Experiment.objects.annotate(
...     day=ExtractDay('start_datetime', tzinfo=melb),
...     weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
...     hour=ExtractHour('start_datetime', tzinfo=melb),
... ).values('day', 'weekday', 'hour').get(
...     end_datetime__year=ExtractYear('start_datetime'),
... )

Change History (5)

comment:1 by Michael Käufl, 7 years ago

Component: UncategorizedDocumentation
Has patch: set

comment:2 by Michael Käufl, 7 years ago

Version: 1.11master

comment:3 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: newclosed

In 3f2b1d92:

Fixed #28568 -- Fixed typo in docs/ref/models/database-functions.txt.

And made an example use naming consistent with the rest of the doc.

comment:4 by Tim Graham <timograham@…>, 7 years ago

In ddea2166:

[1.11.x] Fixed #28568 -- Fixed typo in docs/ref/models/database-functions.txt.

And made an example use naming consistent with the rest of the doc.

Backport of 3f2b1d926bb3a72b4c3d2cd958455ebb9b4ca458 from master

comment:5 by Tim Graham <timograham@…>, 7 years ago

In db7dfbff:

[1.10.x] Fixed #28568 -- Fixed typo in docs/ref/models/database-functions.txt.

And made an example use naming consistent with the rest of the doc.

Backport of 3f2b1d926bb3a72b4c3d2cd958455ebb9b4ca458 from master

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