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/postgresql/operations.py | |
parent | c832885a3e8659d4a704bf103d523b610c24e4ec (diff) | |
download | django-3e09b37f80ab34cf57e245e1fcdabb3d4ff92a38.tar.gz |
Fixed #28649 -- Added ExtractIsoYear database function and iso_year lookup.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index f4e9571f81..b1b83861c1 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -31,6 +31,8 @@ class DatabaseOperations(BaseDatabaseOperations): if lookup_type == 'week_day': # For consistency across backends, we return Sunday=1, Saturday=7. return "EXTRACT('dow' FROM %s) + 1" % field_name + elif lookup_type == 'iso_year': + return "EXTRACT('isoyear' FROM %s)" % field_name else: return "EXTRACT('%s' FROM %s)" % (lookup_type, field_name) |