mirror of https://github.com/django/django.git
Fixed #28568 -- Fixed typo in docs/ref/models/database-functions.txt.
And made an example use naming consistent with the rest of the doc.
This commit is contained in:
parent
5848305218
commit
3f2b1d926b
|
@ -532,8 +532,8 @@ the Melbourne timezone (UTC +10:00), which changes the day, weekday, and hour
|
||||||
values that are returned::
|
values that are returned::
|
||||||
|
|
||||||
>>> import pytz
|
>>> import pytz
|
||||||
>>> tzinfo = pytz.timezone('Australia/Melbourne') # UTC+10:00
|
>>> melb = pytz.timezone('Australia/Melbourne') # UTC+10:00
|
||||||
>>> with timezone.override(tzinfo):
|
>>> with timezone.override(melb):
|
||||||
... Experiment.objects.annotate(
|
... Experiment.objects.annotate(
|
||||||
... day=ExtractDay('start_datetime'),
|
... day=ExtractDay('start_datetime'),
|
||||||
... weekday=ExtractWeekDay('start_datetime'),
|
... weekday=ExtractWeekDay('start_datetime'),
|
||||||
|
@ -547,7 +547,7 @@ Explicitly passing the timezone to the ``Extract`` function behaves in the same
|
||||||
way, and takes priority over an active timezone::
|
way, and takes priority over an active timezone::
|
||||||
|
|
||||||
>>> import pytz
|
>>> import pytz
|
||||||
>>> tzinfo = pytz.timezone('Australia/Melbourne')
|
>>> melb = pytz.timezone('Australia/Melbourne')
|
||||||
>>> Experiment.objects.annotate(
|
>>> Experiment.objects.annotate(
|
||||||
... day=ExtractDay('start_datetime', tzinfo=melb),
|
... day=ExtractDay('start_datetime', tzinfo=melb),
|
||||||
... weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
|
... weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
|
||||||
|
|
Loading…
Reference in New Issue