Ticket #5373: 5373.2.patch

File 5373.2.patch, 1022 bytes (added by Matthias Kestenholz, 15 years ago)

Updated patch to current SVN trunk, added comments

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

    diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
    index a3007a7..ede32f4 100644
    a b class Field(object):  
    151151    def set_attributes_from_name(self, name):
    152152        self.name = name
    153153        self.attname, self.column = self.get_attname_column()
    154         if self.verbose_name is None and name:
    155             self.verbose_name = name.replace('_', ' ')
     154
     155        from django.db.models.fields.related import RelatedField
     156        # RelatedField instances will set the verbose_name later if it is
     157        # not set here already. The default value for RelatedField's
     158        # verbose_name will be the verbose_name of the related model.
     159        if not isinstance(self, RelatedField):
     160            if self.verbose_name is None and name:
     161                self.verbose_name = name.replace('_', ' ')
    156162
    157163    def contribute_to_class(self, cls, name):
    158164        self.set_attributes_from_name(name)
Back to Top