From addd3df3bd39730cd82c52d9726c9b7dbf1bdb8f Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Sun, 8 Feb 2009 05:08:06 +0000 Subject: Fixed #7672 -- Added a 'week_day' lookup type. Many thanks to Ross Poulton for the proposal and implementation on all built-in database backends.. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9818 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/constants.py | 2 +- django/db/models/sql/where.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'django/db/models/sql') diff --git a/django/db/models/sql/constants.py b/django/db/models/sql/constants.py index e14816c965..63c704fea1 100644 --- a/django/db/models/sql/constants.py +++ b/django/db/models/sql/constants.py @@ -4,7 +4,7 @@ import re QUERY_TERMS = dict([(x, None) for x in ( 'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in', 'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year', - 'month', 'day', 'isnull', 'search', 'regex', 'iregex', + 'month', 'day', 'week_day', 'isnull', 'search', 'regex', 'iregex', )]) # Size of each "chunk" for get_iterator calls. diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 8724906a8c..d97112e9f3 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -174,9 +174,9 @@ class WhereNode(tree.Node): params) elif lookup_type in ('range', 'year'): return ('%s BETWEEN %%s and %%s' % field_sql, params) - elif lookup_type in ('month', 'day'): - return ('%s = %%s' % connection.ops.date_extract_sql(lookup_type, - field_sql), params) + elif lookup_type in ('month', 'day', 'week_day'): + return ('%s = %%s' % connection.ops.date_extract_sql(lookup_type, field_sql), + params) elif lookup_type == 'isnull': return ('%s IS %sNULL' % (field_sql, (not value_annot and 'NOT ' or '')), ()) -- cgit v1.3