#36539: Label for related fields should use related model verbose_name attribute
for field
-------------------------------------+-------------------------------------
     Reporter:  Leandro de Souza     |                    Owner:  Leandro
         Type:                       |  de Souza
  Cleanup/optimization               |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  list_display,        |             Triage Stage:  Accepted
  fieldsets                          |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

 Fix should be along these lines:
 {{{ #!diff
 diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py
 index 74bd571e56..23a6b36b9c 100644
 --- a/django/contrib/admin/utils.py
 +++ b/django/contrib/admin/utils.py
 @@ -394,6 +394,8 @@ def label_for_field(name, model, model_admin=None,
 return_attr=False, form=None)

              if hasattr(attr, "short_description"):
                  label = attr.short_description
 +            elif hasattr(attr, "verbose_name"):
 +                label = attr.verbose_name
              elif (
                  isinstance(attr, property)
                  and hasattr(attr, "fget")
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36539#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070198765242e0-b0f37f0b-f13b-46dd-8be0-873997b053ee-000000%40eu-central-1.amazonses.com.

Reply via email to