diff options
| author | Sigurd Ljødal <sigurd@ljodal.no> | 2017-09-28 22:28:48 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-08-18 13:09:15 -0400 |
| commit | 3e09b37f80ab34cf57e245e1fcdabb3d4ff92a38 (patch) | |
| tree | 7b56c5caeb4d6ebe6b5075c711c36a0572419c6f /django/db/backends/sqlite3 | |
| parent | c832885a3e8659d4a704bf103d523b610c24e4ec (diff) | |
Fixed #28649 -- Added ExtractIsoYear database function and iso_year lookup.
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 20905c83b8..d124fcd47b 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -338,6 +338,8 @@ def _sqlite_date_extract(lookup_type, dt): return dt.isocalendar()[1] elif lookup_type == 'quarter': return math.ceil(dt.month / 3) + elif lookup_type == 'iso_year': + return dt.isocalendar()[0] else: return getattr(dt, lookup_type) @@ -410,6 +412,8 @@ def _sqlite_datetime_extract(lookup_type, dt, tzname): return dt.isocalendar()[1] elif lookup_type == 'quarter': return math.ceil(dt.month / 3) + elif lookup_type == 'iso_year': + return dt.isocalendar()[0] else: return getattr(dt, lookup_type) |
