Ticket #5373: 5373.3.diff

File 5373.3.diff, 1.2 KB (added by datakid, 5 years ago)

same again, 4 space indents

  • django/db/models/fields/__init__.py

     
    99
    1010from django.db import connection
    1111from django.db.models.fields.subclassing import LegacyConnection
     12from django.db.models.fields.related import RelatedField
    1213from django.db.models.query_utils import QueryWrapper
    1314from django.conf import settings
    1415from django import forms
     
    228229    def set_attributes_from_name(self, name):
    229230        self.name = name
    230231        self.attname, self.column = self.get_attname_column()
    231         if self.verbose_name is None and name:
    232             self.verbose_name = name.replace('_', ' ')
     232        # RelatedField instances will set the verbose_name later if it is 
     233        # not set here already. The default value for RelatedField's
     234        # verbose_name will be the verbose_name of the related model.
     235        if not isinstance(self, RelatedField):
     236            if self.verbose_name is None and name:
     237                self.verbose_name = name.replace('_', ' ')
    233238
    234239    def contribute_to_class(self, cls, name):
    235240        self.set_attributes_from_name(name)
Back to Top