Ticket #5373: 5373.3.diff
File 5373.3.diff, 1.2 KB (added by , 14 years ago) |
---|
-
django/db/models/fields/__init__.py
9 9 10 10 from django.db import connection 11 11 from django.db.models.fields.subclassing import LegacyConnection 12 from django.db.models.fields.related import RelatedField 12 13 from django.db.models.query_utils import QueryWrapper 13 14 from django.conf import settings 14 15 from django import forms … … 228 229 def set_attributes_from_name(self, name): 229 230 self.name = name 230 231 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('_', ' ') 233 238 234 239 def contribute_to_class(self, cls, name): 235 240 self.set_attributes_from_name(name)