diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2006-06-06 01:21:49 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2006-06-06 01:21:49 +0000 |
| commit | e976ed1f7910fad03704f88853c5c5b36cbab134 (patch) | |
| tree | c4c8d32d4298f64ad9ce8e7813084c2f45a9dc40 /django/db | |
| parent | 0c341d780ebcde0e81c81eda07e2db3aaa92549b (diff) | |
multi-auth: Merged to [3085]
git-svn-id: http://code.djangoproject.com/svn/django/branches/multi-auth@3086 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/ado_mssql/base.py | 3 | ||||
| -rw-r--r-- | django/db/backends/dummy/base.py | 1 | ||||
| -rw-r--r-- | django/db/backends/mysql/base.py | 3 | ||||
| -rw-r--r-- | django/db/backends/oracle/base.py | 9 | ||||
| -rw-r--r-- | django/db/backends/postgresql/base.py | 3 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/base.py | 3 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 3 | ||||
| -rw-r--r-- | django/db/models/fields/__init__.py | 2 | ||||
| -rw-r--r-- | django/db/models/fields/related.py | 4 | ||||
| -rw-r--r-- | django/db/models/query.py | 2 |
10 files changed, 28 insertions, 5 deletions
diff --git a/django/db/backends/ado_mssql/base.py b/django/db/backends/ado_mssql/base.py index c5a3b2cc33..b645b053bf 100644 --- a/django/db/backends/ado_mssql/base.py +++ b/django/db/backends/ado_mssql/base.py @@ -125,6 +125,9 @@ def get_limit_offset_sql(limit, offset=None): def get_random_function_sql(): return "RAND()" +def get_fulltext_search_sql(field_name): + raise NotImplementedError + def get_drop_foreignkey_sql(): return "DROP CONSTRAINT" diff --git a/django/db/backends/dummy/base.py b/django/db/backends/dummy/base.py index 89fec00c1d..985fe96469 100644 --- a/django/db/backends/dummy/base.py +++ b/django/db/backends/dummy/base.py @@ -33,5 +33,6 @@ get_date_extract_sql = complain get_date_trunc_sql = complain get_limit_offset_sql = complain get_random_function_sql = complain +get_fulltext_search_sql = complain get_drop_foreignkey_sql = complain OPERATOR_MAPPING = {} diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 6a53956cad..4a13450c67 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -152,6 +152,9 @@ def get_limit_offset_sql(limit, offset=None): def get_random_function_sql(): return "RAND()" +def get_fulltext_search_sql(field_name): + return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name + def get_drop_foreignkey_sql(): return "DROP FOREIGN KEY" diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index a7c866484e..e981805108 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -65,11 +65,13 @@ class FormatStylePlaceholderCursor(Database.Cursor): This fixes it -- but note that if you want to use a literal "%s" in a query, you'll need to use "%%s". """ - def execute(self, query, params=[]): + def execute(self, query, params=None): + if params is None: params = [] query = self.convert_arguments(query, len(params)) return Database.Cursor.execute(self, query, params) - def executemany(self, query, params=[]): + def executemany(self, query, params=None): + if params is None: params = [] query = self.convert_arguments(query, len(params[0])) return Database.Cursor.executemany(self, query, params) @@ -106,6 +108,9 @@ def get_limit_offset_sql(limit, offset=None): def get_random_function_sql(): return "DBMS_RANDOM.RANDOM" +def get_fulltext_search_sql(field_name): + raise NotImplementedError + def get_drop_foreignkey_sql(): return "DROP FOREIGN KEY" diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index a365434318..decb160ee9 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -102,6 +102,9 @@ def get_limit_offset_sql(limit, offset=None): def get_random_function_sql(): return "RANDOM()" +def get_fulltext_search_sql(field_name): + raise NotImplementedError + def get_drop_foreignkey_sql(): return "DROP CONSTRAINT" diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index 13e7be7a98..697a33bb76 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -108,6 +108,9 @@ def get_limit_offset_sql(limit, offset=None): def get_random_function_sql(): return "RANDOM()" +def get_fulltext_search_sql(field_name): + raise NotImplementedError + def get_drop_foreignkey_sql(): return "DROP CONSTRAINT" diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 7c3018aed9..7b51967416 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -124,6 +124,9 @@ def get_limit_offset_sql(limit, offset=None): def get_random_function_sql(): return "RANDOM()" +def get_fulltext_search_sql(field_name): + raise NotImplementedError + def get_drop_foreignkey_sql(): return "" diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index b5245d6624..2f8a8651a1 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -162,7 +162,7 @@ class Field(object): def get_db_prep_lookup(self, lookup_type, value): "Returns field's value prepared for database lookup." - if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne', 'year', 'month', 'day'): + if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne', 'year', 'month', 'day', 'search'): return [value] elif lookup_type in ('range', 'in'): return value diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 5f6ec83bb6..6e0fb6d2a8 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -198,7 +198,7 @@ class ForeignRelatedObjectsDescriptor(object): setattr(obj, rel_field.name, None) obj.save() else: - raise rel_field.rel.to.DoesNotExist, "'%s' is not related to '%s'." % (obj, instance) + raise rel_field.rel.to.DoesNotExist, "%r is not related to %r." % (obj, instance) remove.alters_data = True def clear(self): @@ -712,7 +712,7 @@ class ManyToManyRel: self.related_name = related_name self.filter_interface = filter_interface if limit_choices_to is None: - limit_choices_to = {} + limit_choices_to = {} self.limit_choices_to = limit_choices_to self.edit_inline = False self.raw_id_admin = raw_id_admin diff --git a/django/db/models/query.py b/django/db/models/query.py index 3517d6bed5..4bd9b3b9fe 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -615,6 +615,8 @@ def get_where_clause(lookup_type, table_prefix, field_name, value): return "%s = %%s" % backend.get_date_extract_sql(lookup_type, table_prefix + field_name) elif lookup_type == 'isnull': return "%s%s IS %sNULL" % (table_prefix, field_name, (not value and 'NOT ' or '')) + elif lookup_type == 'search': + return backend.get_fulltext_search_sql(table_prefix + field_name) raise TypeError, "Got invalid lookup_type: %s" % repr(lookup_type) def get_cached_row(klass, row, index_start): |
