diff options
| author | Tobias Bengfort <tobias.bengfort@posteo.de> | 2021-04-06 18:14:16 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-04-20 11:44:41 +0200 |
| commit | 54e94640ace261b14cf8cdb1fae3dc6f068a5f87 (patch) | |
| tree | 12e432a1a539303dd51ba2691e87b3aaba03a338 /django/db/backends/sqlite3/base.py | |
| parent | 9e1ccd7283e8544d86cba35c820a7d741f5d2712 (diff) | |
Refs #25287 -- Added support for multiplying and dividing DurationField by scalar values on SQLite.
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 35466189e6..a64190f0d0 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -563,6 +563,7 @@ def _sqlite_format_dtdelta(conn, lhs, rhs): LHS and RHS can be either: - An integer number of microseconds - A string representing a datetime + - A scalar value, e.g. float """ conn = conn.strip() try: @@ -574,8 +575,12 @@ def _sqlite_format_dtdelta(conn, lhs, rhs): # typecast_timestamp returns a date or a datetime without timezone. # It will be formatted as "%Y-%m-%d" or "%Y-%m-%d %H:%M:%S[.%f]" out = str(real_lhs + real_rhs) - else: + elif conn == '-': out = str(real_lhs - real_rhs) + elif conn == '*': + out = real_lhs * real_rhs + else: + out = real_lhs / real_rhs return out |
