Refs #25774, #26348 -- Allowed Trunc functions to operate with time fields.

Thanks Josh for the amazing testing setup and Tim for the review.
This commit is contained in:
Simon Charette 2016-06-18 23:38:24 -04:00
parent 90468079ec
commit 082c52dbed
11 changed files with 245 additions and 35 deletions

View file

@ -198,6 +198,9 @@ Models
* :class:`~django.db.models.ImageField` now has a default
:data:`~django.core.validators.validate_image_file_extension` validator.
* Added support for time truncation to
:class:`~django.db.models.functions.datetime.Trunc` functions.
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~
@ -263,7 +266,12 @@ Backwards incompatible changes in 1.11
Database backend API
--------------------
* ...
* The ``DatabaseOperations.time_trunc_sql()`` method is added to support
``TimeField`` truncation. It accepts a ``lookup_type`` and ``field_name``
arguments and returns the appropriate SQL to truncate the given time field
``field_name`` to a time object with only the given specificity. The
``lookup_type`` argument can be either ``'hour'``, ``'minute'``, or
``'second'``.
Dropped support for PostgreSQL 9.2 and PostGIS 2.0
--------------------------------------------------