Author: russellm
Date: 2010-07-29 21:59:14 -0500 (Thu, 29 Jul 2010)
New Revision: 13454

Modified:
   django/branches/releases/1.2.X/django/db/models/fields/related.py
Log:
[1.2.X] Fixed #13730 -- Removed the hard-coding of the requirement that 
ForeignKeys have an index. Thanks to Suor for the report.

Backport of r13452 from trunk.

Modified: django/branches/releases/1.2.X/django/db/models/fields/related.py
===================================================================
--- django/branches/releases/1.2.X/django/db/models/fields/related.py   
2010-07-30 02:58:51 UTC (rev 13453)
+++ django/branches/releases/1.2.X/django/db/models/fields/related.py   
2010-07-30 02:59:14 UTC (rev 13454)
@@ -812,6 +812,9 @@
             to_field = to_field or (to._meta.pk and to._meta.pk.name)
         kwargs['verbose_name'] = kwargs.get('verbose_name', None)
 
+        if 'db_index' not in kwargs:
+            kwargs['db_index'] = True
+
         kwargs['rel'] = rel_class(to, to_field,
             related_name=kwargs.pop('related_name', None),
             limit_choices_to=kwargs.pop('limit_choices_to', None),
@@ -819,8 +822,6 @@
             parent_link=kwargs.pop('parent_link', False))
         Field.__init__(self, **kwargs)
 
-        self.db_index = True
-
     def validate(self, value, model_instance):
         if self.rel.parent_link:
             return

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to