diff options
author | Simon Charette <charette.s@gmail.com> | 2016-06-18 23:38:24 -0400 |
---|---|---|
committer | Simon Charette <charette.s@gmail.com> | 2016-07-08 12:35:34 -0400 |
commit | 082c52dbedd76c312cebf3b23e04c449a94c20b6 (patch) | |
tree | 0ae566d52a61ac42f5a918931684fd3779f045af /django/db/backends/postgresql/operations.py | |
parent | 90468079ec6f72a1b8b6a908d81d3201a3204b24 (diff) | |
download | django-082c52dbedd76c312cebf3b23e04c449a94c20b6.tar.gz |
Refs #25774, #26348 -- Allowed Trunc functions to operate with time fields.
Thanks Josh for the amazing testing setup and Tim for the review.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 9b64615001..2130571a05 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -56,6 +56,9 @@ class DatabaseOperations(BaseDatabaseOperations): sql = "DATE_TRUNC('%s', %s)" % (lookup_type, field_name) return sql, params + def time_trunc_sql(self, lookup_type, field_name): + return "DATE_TRUNC('%s', %s)::time" % (lookup_type, field_name) + def deferrable_sql(self): return " DEFERRABLE INITIALLY DEFERRED" |