#28568: Example in reference of Database Functions leads to NameError
-----------------------------------------+------------------------
Reporter: Michael Käufl | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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'),
... )
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28568>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.bf079a1ba1743fed0345791af9fd569d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.