﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33352	ModelAdmin.list_display option should support double-underscore notation to express field-of-associated-model	Ofer Nave	nobody	"Many of the options on ModelAdmin already support double-underscore notation, such as 'ordering' and 'search_fields':

https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields

However, 'list_display' doesn't.  This seems like an extremely common use case that everyone would benefit from.  For example, imagine I have the following models:

{{{
class User(models.Model):
    name = models.CharField(max_length=50)

class CreditCard(models.Model):
    owner = models.ForeignKey(User)
    label = models.CharField(max_length=30)
    limit = models.IntegerField()
}}}

And wanted to include the credit card owner's name as a column on the Changelist page for CreditCard.  Right now I have to do this:

{{{
class CreditCardAdmin(admin.ModelAdmin):
    list_display = [ 'owner_name', 'label', 'limit' ]

    @admin.display(ordering='owner__name', description='Owner')
    def owner_name(self, obj):
        return obj.owner.name
}}}

Instead of just doing this:

{{{
class CreditCardAdmin(admin.ModelAdmin):
    list_display = [ 'owner__name', 'label', 'limit' ]
}}}

BTW - A version of this is already implemented in the [https://pypi.org/project/django-related-admin/ django-related-admin] package:
https://github.com/PetrDlouhy/django-related-admin/"	New feature	closed	contrib.admin	4.0	Normal	duplicate		Adam Johnson	Unreviewed	0	0	0	0	0	0
