From 766afc22a1dfa7d34a08de85356b7bc9dba025e7 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Tue, 19 Jan 2016 20:43:41 -0500 Subject: Fixed #24793 -- Unified temporal difference support. --- django/db/backends/postgresql/operations.py | 7 +++++++ 1 file changed, 7 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 3624c9cf56..5bd433c639 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -239,3 +239,10 @@ class DatabaseOperations(BaseDatabaseOperations): if value: return Inet(value) return None + + def subtract_temporals(self, internal_type, lhs, rhs): + if internal_type == 'DateField': + lhs_sql, lhs_params = lhs + rhs_sql, rhs_params = rhs + return "age(%s, %s)" % (lhs_sql, rhs_sql), lhs_params + rhs_params + return super(DatabaseOperations, self).subtract_temporals(internal_type, lhs, rhs) -- cgit v1.2.1