diff options
author | Simon Charette <charette.s@gmail.com> | 2016-01-19 20:43:41 -0500 |
---|---|---|
committer | Simon Charette <charette.s@gmail.com> | 2016-02-26 12:25:12 -0500 |
commit | 766afc22a1dfa7d34a08de85356b7bc9dba025e7 (patch) | |
tree | b37eb872bed24bbaeafd7a57cd5f656b54dc47b8 /django/db/backends/postgresql/operations.py | |
parent | 31098e3288595c13f165935f2579f1af744e5240 (diff) | |
download | django-766afc22a1dfa7d34a08de85356b7bc9dba025e7.tar.gz |
Fixed #24793 -- Unified temporal difference support.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 7 |
1 files changed, 7 insertions, 0 deletions
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) |