Ticket #13963: admin-relatedobject.patch

File admin-relatedobject.patch, 657 bytes (added by sfllaw, 5 years ago)
  • django/contrib/admin/util.py

    old new def lookup_field(name, obj, model_admin= 
    279279def label_for_field(name, model, model_admin=None, return_attr=False):
    280280    attr = None
    281281    try:
    282         label = model._meta.get_field_by_name(name)[0].verbose_name
     282        field = model._meta.get_field_by_name(name)[0]
     283        try:
     284            label = field.verbose_name
     285        except AttributeError:
     286            label = field.var_name
    283287    except models.FieldDoesNotExist:
    284288        if name == "__unicode__":
    285289            label = force_unicode(model._meta.verbose_name)
Back to Top