mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #17260 -- Added time zone aware aggregation and lookups.
Thanks Carl Meyer for the review. Squashed commit of the following: commit4f290bdb60Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 13 21:21:30 2013 +0100 Used '0:00' instead of 'UTC' which doesn't always exist in Oracle. Thanks Ian Kelly for the suggestion. commit01b6366f3cAuthor: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 13 13:38:43 2013 +0100 Made tzname a parameter of datetime_extract/trunc_sql. This is required to work around a bug in Oracle. commit924a144ef8Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 13 14:47:44 2013 +0100 Added support for parameters in SELECT clauses. commitb4351d2890Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 22:30:22 2013 +0100 Documented backwards incompatibilities in the two previous commits. commit91ef84713cAuthor: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 09:42:31 2013 +0100 Used QuerySet.datetimes for the admin's date_hierarchy. commit0d0de288a5Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 09:29:38 2013 +0100 Used QuerySet.datetimes in date-based generic views. commit9c0859ff7cAuthor: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:43:25 2013 +0100 Implemented QuerySet.datetimes on Oracle. commit68ab511a4fAuthor: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:43:14 2013 +0100 Implemented QuerySet.datetimes on MySQL. commit22d52681d3Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:42:29 2013 +0100 Implemented QuerySet.datetimes on SQLite. commitf6800fd04cAuthor: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:43:03 2013 +0100 Implemented QuerySet.datetimes on PostgreSQL. commit0c829c23f4Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:41:08 2013 +0100 Added datetime-handling infrastructure in the ORM layers. commit104d82a777Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 10:05:55 2013 +0100 Updated null_queries tests to avoid clashing with the __second lookup. commitc01bbb3235Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 23:07:41 2013 +0100 Updated tests of .dates(). Replaced .dates() by .datetimes() for DateTimeFields. Replaced dates with datetimes in the expected output for DateFields. commit50fb7a5246Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:40:09 2013 +0100 Updated and added tests for QuerySet.datetimes. commita8451a5004Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 22:34:46 2013 +0100 Documented the new time lookups and updated the date lookups. commit29413eab2bAuthor: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 16:15:49 2013 +0100 Documented QuerySet.datetimes and updated QuerySet.dates.
This commit is contained in:
@@ -30,6 +30,16 @@ prevention <clickjacking-prevention>` are turned on.
|
||||
If the default templates don't suit your tastes, you can use :ref:`custom
|
||||
project and app templates <custom-app-and-project-templates>`.
|
||||
|
||||
Time zone aware aggregation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The support for :doc:`time zones </topics/i18n/timezones>` introduced in
|
||||
Django 1.4 didn't work well with :meth:`QuerySet.dates()
|
||||
<django.db.models.query.QuerySet.dates>`: aggregation was always performed in
|
||||
UTC. This limitation was lifted in Django 1.6. Use :meth:`QuerySet.datetimes()
|
||||
<django.db.models.query.QuerySet.datetimes>` to perform time zone aware
|
||||
aggregation on a :class:`~django.db.models.DateTimeField`.
|
||||
|
||||
Minor features
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
@@ -47,6 +57,9 @@ Minor features
|
||||
* Added :meth:`~django.db.models.query.QuerySet.earliest` for symmetry with
|
||||
:meth:`~django.db.models.query.QuerySet.latest`.
|
||||
|
||||
* In addition to :lookup:`year`, :lookup:`month` and :lookup:`day`, the ORM
|
||||
now supports :lookup:`hour`, :lookup:`minute` and :lookup:`second` lookups.
|
||||
|
||||
* The default widgets for :class:`~django.forms.EmailField` and
|
||||
:class:`~django.forms.URLField` use the new type attributes available in
|
||||
HTML5 (type='email', type='url').
|
||||
@@ -80,6 +93,28 @@ Backwards incompatible changes in 1.6
|
||||
:meth:`~django.db.models.query.QuerySet.none` has been called:
|
||||
``isinstance(qs.none(), EmptyQuerySet)``
|
||||
|
||||
* :meth:`QuerySet.dates() <django.db.models.query.QuerySet.dates>` raises an
|
||||
error if it's used on :class:`~django.db.models.DateTimeField` when time
|
||||
zone support is active. Use :meth:`QuerySet.datetimes()
|
||||
<django.db.models.query.QuerySet.datetimes>` instead.
|
||||
|
||||
* :meth:`QuerySet.dates() <django.db.models.query.QuerySet.dates>` returns a
|
||||
list of :class:`~datetime.date`. It used to return a list of
|
||||
:class:`~datetime.datetime`.
|
||||
|
||||
* The :attr:`~django.contrib.admin.ModelAdmin.date_hierarchy` feature of the
|
||||
admin on a :class:`~django.db.models.DateTimeField` requires time zone
|
||||
definitions in the database when :setting:`USE_TZ` is ``True``.
|
||||
:ref:`Learn more <database-time-zone-definitions>`.
|
||||
|
||||
* Accessing ``date_list`` in the context of a date-based generic view requires
|
||||
time zone definitions in the database when the view is based on a
|
||||
:class:`~django.db.models.DateTimeField` and :setting:`USE_TZ` is ``True``.
|
||||
:ref:`Learn more <database-time-zone-definitions>`.
|
||||
|
||||
* Model fields named ``hour``, ``minute`` or ``second`` may clash with the new
|
||||
lookups. Append an explicit :lookup:`exact` lookup if this is an issue.
|
||||
|
||||
* If your CSS/Javascript code used to access HTML input widgets by type, you
|
||||
should review it as ``type='text'`` widgets might be now output as
|
||||
``type='email'`` or ``type='url'`` depending on their corresponding field type.
|
||||
|
||||
Reference in New Issue
Block a user