From 082c52dbedd76c312cebf3b23e04c449a94c20b6 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sat, 18 Jun 2016 23:38:24 -0400 Subject: Refs #25774, #26348 -- Allowed Trunc functions to operate with time fields. Thanks Josh for the amazing testing setup and Tim for the review. --- django/db/backends/postgresql/operations.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'django/db/backends/postgresql/operations.py') 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" -- cgit v1.2.1