Ticket #13730: soft_db_index.diff

File soft_db_index.diff, 887 bytes (added by Suor, 5 years ago)
  • django/db/models/fields/related.py

     
    812812            to_field = to_field or (to._meta.pk and to._meta.pk.name)
    813813        kwargs['verbose_name'] = kwargs.get('verbose_name', None)
    814814
     815        if 'db_index' not in kwargs:
     816            kwargs['db_index'] = True
    815817        kwargs['rel'] = rel_class(to, to_field,
    816818            related_name=kwargs.pop('related_name', None),
    817819            limit_choices_to=kwargs.pop('limit_choices_to', None),
     
    819821            parent_link=kwargs.pop('parent_link', False))
    820822        Field.__init__(self, **kwargs)
    821823
    822         self.db_index = True
    823 
    824824    def validate(self, value, model_instance):
    825825        if self.rel.parent_link:
    826826            return
Back to Top