#35765: Change label of list_display with __ lookup to only show the bit after 
the
__
--------------------------------+-----------------------------------------
     Reporter:  Kevin Renskers  |                     Type:  Uncategorized
       Status:  new             |                Component:  contrib.admin
      Version:  5.0             |                 Severity:  Normal
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+-----------------------------------------
 In Django 5.1 ticket #10743 was implemented: `ModelAdmin.list_display now
 supports using __ lookups to list fields from related models.` This is
 great!

 However, the default label in the admin list is the full thing, which can
 get very long and wordy. For example in my `UserAdmin` config I can add
 `account_settings__pace_account_id` to the `list_display` (the `User`
 model has a one-to-one relationship with an `AccountSettings` model). The
 label in the Django Admin then becomes "ACCOUNT SETTINGS PACE ACCOUNT ID"
 which is extremely long. I would've expected it to be simply "PACE ACCOUNT
 ID".

 So the result is that I am never using the new double underscore lookup
 feature for `list_display`, and instead I am still creating small getter
 functions like this:

 {{{
 def pace_account_id(self, obj):
     return obj.account_settings.pace_account_id
 }}}

 Is there any chance that the way the label for double-underscore-
 containing `list_display` values is generated could be changed, so that
 only the bit after the double underscore is shown?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35765>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191f7229e69-a24344e2-27c6-4815-adc7-042542a51f48-000000%40eu-central-1.amazonses.com.

Reply via email to