Fixed #13730 -- Removed the hard-coding of the requirement that ForeignKeys have an index. Thanks to Suor for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13452 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f185a58025
commit
8b73acdf4d
|
@ -812,6 +812,9 @@ class ForeignKey(RelatedField, Field):
|
||||||
to_field = to_field or (to._meta.pk and to._meta.pk.name)
|
to_field = to_field or (to._meta.pk and to._meta.pk.name)
|
||||||
kwargs['verbose_name'] = kwargs.get('verbose_name', None)
|
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,
|
kwargs['rel'] = rel_class(to, to_field,
|
||||||
related_name=kwargs.pop('related_name', None),
|
related_name=kwargs.pop('related_name', None),
|
||||||
limit_choices_to=kwargs.pop('limit_choices_to', None),
|
limit_choices_to=kwargs.pop('limit_choices_to', None),
|
||||||
|
@ -819,8 +822,6 @@ class ForeignKey(RelatedField, Field):
|
||||||
parent_link=kwargs.pop('parent_link', False))
|
parent_link=kwargs.pop('parent_link', False))
|
||||||
Field.__init__(self, **kwargs)
|
Field.__init__(self, **kwargs)
|
||||||
|
|
||||||
self.db_index = True
|
|
||||||
|
|
||||||
def validate(self, value, model_instance):
|
def validate(self, value, model_instance):
|
||||||
if self.rel.parent_link:
|
if self.rel.parent_link:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue