Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #13730 -- Removed the hard-coding of the requirement that Forei…

…gnKeys have an index. Thanks to Suor for the report.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8b73acdf4da82840eebfe2fb77e4806cf37a23c4 1 parent f185a58
@freakboy3742 freakboy3742 authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/db/models/fields/
5 django/db/models/fields/
@@ -812,6 +812,9 @@ def __init__(self, to, to_field=None, rel_class=ManyToOneRel, **kwargs):
to_field = to_field or ( and
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 @@ def __init__(self, to, to_field=None, rel_class=ManyToOneRel, **kwargs):
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:
Please sign in to comment.
Something went wrong with that request. Please try again.