1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #26348 -- Added TruncTime and exposed it through the __time lookup.

Thanks Tim for the review.
This commit is contained in:
Simon Charette
2016-06-18 23:39:26 -04:00
parent 082c52dbed
commit 8a4f017f45
12 changed files with 119 additions and 3 deletions

View File

@@ -686,6 +686,17 @@ that deal with time-parts can be used with ``TimeField``::
truncate function. It's also registered as a transform on ``DateTimeField`` as
``__date``.
.. class:: TruncTime(expression, **extra)
.. versionadded:: 1.11
.. attribute:: lookup_name = 'time'
.. attribute:: output_field = TimeField()
``TruncTime`` casts ``expression`` to a time rather than using the built-in SQL
truncate function. It's also registered as a transform on ``DateTimeField`` as
``__time``.
.. class:: TruncDay(expression, output_field=None, tzinfo=None, **extra)
.. attribute:: kind = 'day'