Ticket #14695: field_name.diff

File field_name.diff, 782 bytes (added by erikrose, 14 years ago)

Patch against Django 1.2.3

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

    diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
    index 3c58873..fce5269 100644
    a b class Field(object):  
    226226    unique = property(unique)
    227227
    228228    def set_attributes_from_name(self, name):
    229         self.name = name
     229        if not self.name:
     230            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        if self.verbose_name is None and self.name:
     233            self.verbose_name = self.name.replace('_', ' ')
    233234
    234235    def contribute_to_class(self, cls, name):
    235236        self.set_attributes_from_name(name)
Back to Top