Fixed #21095 -- Documented new requirement for dates lookups.
Day, month, and week_day lookups now require time zone definitions in the database.
This commit is contained in:
parent
8b366a50f4
commit
9451d8d558
|
@ -2274,7 +2274,8 @@ SQL equivalent::
|
||||||
(The exact SQL syntax varies for each database engine.)
|
(The exact SQL syntax varies for each database engine.)
|
||||||
|
|
||||||
When :setting:`USE_TZ` is ``True``, datetime fields are converted to the
|
When :setting:`USE_TZ` is ``True``, datetime fields are converted to the
|
||||||
current time zone before filtering.
|
current time zone before filtering. This requires :ref:`time zone definitions
|
||||||
|
in the database <database-time-zone-definitions>`.
|
||||||
|
|
||||||
.. fieldlookup:: day
|
.. fieldlookup:: day
|
||||||
|
|
||||||
|
@ -2297,7 +2298,8 @@ Note this will match any record with a pub_date on the third day of the month,
|
||||||
such as January 3, July 3, etc.
|
such as January 3, July 3, etc.
|
||||||
|
|
||||||
When :setting:`USE_TZ` is ``True``, datetime fields are converted to the
|
When :setting:`USE_TZ` is ``True``, datetime fields are converted to the
|
||||||
current time zone before filtering.
|
current time zone before filtering. This requires :ref:`time zone definitions
|
||||||
|
in the database <database-time-zone-definitions>`.
|
||||||
|
|
||||||
.. fieldlookup:: week_day
|
.. fieldlookup:: week_day
|
||||||
|
|
||||||
|
@ -2321,7 +2323,8 @@ Note this will match any record with a ``pub_date`` that falls on a Monday (day
|
||||||
are indexed with day 1 being Sunday and day 7 being Saturday.
|
are indexed with day 1 being Sunday and day 7 being Saturday.
|
||||||
|
|
||||||
When :setting:`USE_TZ` is ``True``, datetime fields are converted to the
|
When :setting:`USE_TZ` is ``True``, datetime fields are converted to the
|
||||||
current time zone before filtering.
|
current time zone before filtering. This requires :ref:`time zone definitions
|
||||||
|
in the database <database-time-zone-definitions>`.
|
||||||
|
|
||||||
.. fieldlookup:: hour
|
.. fieldlookup:: hour
|
||||||
|
|
||||||
|
|
|
@ -435,6 +435,21 @@ but will not be removed from Django until version 1.8.
|
||||||
|
|
||||||
.. _recommendations in the Python documentation: http://docs.python.org/2/library/doctest.html#unittest-api
|
.. _recommendations in the Python documentation: http://docs.python.org/2/library/doctest.html#unittest-api
|
||||||
|
|
||||||
|
Time zone-aware ``day``, ``month``, and ``week_day`` lookups
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Django 1.6 introduces time zone support for :lookup:`day`, :lookup:`month`,
|
||||||
|
and :lookup:`week_day` lookups when :setting:`USE_TZ` is ``True``. These
|
||||||
|
lookups were previously performed in UTC regardless of the current time zone.
|
||||||
|
|
||||||
|
This requires :ref:`time zone definitions in the database
|
||||||
|
<database-time-zone-definitions>`. If you're using SQLite, you must install
|
||||||
|
pytz_. If you're using MySQL, you must install pytz_ and load the time zone
|
||||||
|
tables with `mysql_tzinfo_to_sql`_.
|
||||||
|
|
||||||
|
.. _pytz: http://pytz.sourceforge.net/
|
||||||
|
.. _mysql_tzinfo_to_sql: http://dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html
|
||||||
|
|
||||||
Addition of ``QuerySet.datetimes()``
|
Addition of ``QuerySet.datetimes()``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue