diff options
author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2014-07-24 13:57:24 +0100 |
---|---|---|
committer | Marc Tamlyn <marc.tamlyn@gmail.com> | 2014-12-20 18:28:29 +0000 |
commit | 57554442fe3e209c135e15dda4ea45123e579e58 (patch) | |
tree | 0ef2cb0e3048d13b82e4c7e81192df6124556a44 /django/db/backends/postgresql_psycopg2/operations.py | |
parent | a3d96bee36040975ded8e3bf02e33e48d06f1f16 (diff) | |
download | django-57554442fe3e209c135e15dda4ea45123e579e58.tar.gz |
Fixed #2443 -- Added DurationField.
A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.
Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.
Thanks to Tim and Josh in particular for reviews.
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/operations.py')
-rw-r--r-- | django/db/backends/postgresql_psycopg2/operations.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py index 0e512b91fa..3447bfe682 100644 --- a/django/db/backends/postgresql_psycopg2/operations.py +++ b/django/db/backends/postgresql_psycopg2/operations.py @@ -16,23 +16,6 @@ class DatabaseOperations(BaseDatabaseOperations): else: return "EXTRACT('%s' FROM %s)" % (lookup_type, field_name) - def date_interval_sql(self, sql, connector, timedelta): - """ - implements the interval functionality for expressions - format for Postgres: - (datefield + interval '3 days 200 seconds 5 microseconds') - """ - modifiers = [] - if timedelta.days: - modifiers.append('%s days' % timedelta.days) - if timedelta.seconds: - modifiers.append('%s seconds' % timedelta.seconds) - if timedelta.microseconds: - modifiers.append('%s microseconds' % timedelta.microseconds) - mods = ' '.join(modifiers) - conn = ' %s ' % connector - return '(%s)' % conn.join([sql, 'interval \'%s\'' % mods]) - def date_trunc_sql(self, lookup_type, field_name): # http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC return "DATE_TRUNC('%s', %s)" % (lookup_type, field_name) |