Ticket #4114: related.patch

File related.patch, 1.2 KB (added by anonymous, 8 years ago)

Patch of default verbose_name for ForeignKey and OneToOneField

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

     
    472472            assert isinstance(to, basestring), "ForeignKey(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (to, RECURSIVE_RELATIONSHIP_CONSTANT)
    473473        else:
    474474            to_field = to_field or to._meta.pk.name
    475         kwargs['verbose_name'] = kwargs.get('verbose_name', '')
     475        kwargs['verbose_name'] = kwargs.get('verbose_name', to._meta.verbose_name)
    476476
    477477        if kwargs.has_key('edit_inline_type'):
    478478            import warnings
     
    565565            assert isinstance(to, basestring), "OneToOneField(%r) is invalid. First parameter to OneToOneField must be either a model, a model name, or the string %r" % (to, RECURSIVE_RELATIONSHIP_CONSTANT)
    566566        else:
    567567            to_field = to_field or to._meta.pk.name
    568         kwargs['verbose_name'] = kwargs.get('verbose_name', '')
     568        kwargs['verbose_name'] = kwargs.get('verbose_name', to._meta.verbose_name)
    569569
    570570        if kwargs.has_key('edit_inline_type'):
    571571            import warnings
Back to Top