Example in reference of Database Functions leads to NameError
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)
Component: |
Uncategorized → Documentation
|
Has patch: |
set
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
pull request: https://github.com/django/django/pull/9022