Ticket #5373: 5373.3.patch

File 5373.3.patch, 1.0 KB (added by datakid, 4 years ago)

adapted patch to put import at the top of the file


    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 = name 
    230231        self.attname, self.column = self.get_attname_column() 
    231         if self.verbose_name is None and name: 
     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: 
    232237            self.verbose_name = name.replace('_', ' ') 
    234239    def contribute_to_class(self, cls, name):