1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[1.2.X] Fixed #13967 -- MySQL spatial backend now respects when spatial_index=False. Thanks, Simon Law, for bug report and patch.

Backport of r13443 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13444 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2010-07-21 15:28:06 +00:00
parent 5dc560636b
commit 8c87622f8b

View File

@ -6,7 +6,7 @@ class MySQLCreation(DatabaseCreation):
from django.contrib.gis.db.models.fields import GeometryField from django.contrib.gis.db.models.fields import GeometryField
output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style) output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)
if isinstance(f, GeometryField): if isinstance(f, GeometryField) and f.spatial_index:
qn = self.connection.ops.quote_name qn = self.connection.ops.quote_name
db_table = model._meta.db_table db_table = model._meta.db_table
idx_name = '%s_%s_id' % (db_table, f.column) idx_name = '%s_%s_id' % (db_table, f.column)