You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
django-related-admin is no longer needed for modern Django projects!
As of Django 5.1+, double-underscore lookups in list_display are natively supported.
You should remove this package from your project and use the built-in Django admin functionality instead.
Allow foreign key attributes in Django admin change list list_display with '__'
Note: Django-related-admin changes change_list.html template to disable white-space: nowrap;
css class on admin headers to allow long (posibly related) header names to wrap.
If you want this behaviour, add the app before django.contrib.admin, otherwise after.
Usage
Just use it instead of model.Admin:
from related_admin import RelatedFieldAdmin
from related_admin import getter_for_related_field
class FooAdmin(RelatedFieldAdmin):
# these fields will work automatically (and boolean fields will display an icon):
list_display = ('address__phone','address__country__country_code','address__foo')
# ... but you can also define them manually if you need to override short_description or boolean parameter:
address__foo = getter_for_related_field('address__foo', short_description='Custom Name', boolean=True)
About
Allow foreign key attributes in list_display with '__'