diff options
| author | Andrew Clark <amclark7@gmail.com> | 2013-06-26 01:07:18 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-06-26 08:13:26 -0400 |
| commit | 273dc550a4eccdad958541f456332312b3369504 (patch) | |
| tree | d31272f7bc4e343a2e808e4961d73777d681694a /django | |
| parent | c6862d57c1e987f0f98a77826d19358b9040bad1 (diff) | |
Fixed #20462 -- null/non-string regex lookups are now consistent
Thanks to noirbizarre for the report and initial patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/operations.py | 2 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py index f96757da8b..c5aab84693 100644 --- a/django/db/backends/postgresql_psycopg2/operations.py +++ b/django/db/backends/postgresql_psycopg2/operations.py @@ -69,7 +69,7 @@ class DatabaseOperations(BaseDatabaseOperations): # Cast text lookups to text to allow things like filter(x__contains=4) if lookup_type in ('iexact', 'contains', 'icontains', 'startswith', - 'istartswith', 'endswith', 'iendswith'): + 'istartswith', 'endswith', 'iendswith', 'regex', 'iregex'): lookup = "%s::text" # Use UPPER(x) for case-insensitive lookups; it's faster. diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 18c4029649..b9caf8b99f 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -522,4 +522,4 @@ def _sqlite_format_dtdelta(dt, conn, days, secs, usecs): return str(dt) def _sqlite_regexp(re_pattern, re_string): - return bool(re.search(re_pattern, re_string)) + return bool(re.search(re_pattern, str(re_string))) if re_string is not None else False |
