Dear List,

The idea of allowing relations lookups in the list display was proposed in
ticket #5863 <https://code.djangoproject.com/ticket/5863>, but it was
closed as wontfix 5 years ago.

The reason it was closed as wontfix is because it's quite easy to achieve
exactly the same result with a method on the ModelAdmin.

However, that workaround is much more verbose, and makes the code much less
readable. And I'm pretty sure I'm not the only one to use this in almost
all ModelAdmins.

What is your opinion about reopening the ticket ?

Compare the suggested syntax :

class BookAdmin(admin.ModelAdmin):
>     list_display = ('title','author__name')


vs the current syntax :

class BookAdmin(admin.ModelAdmin):
>     list_display = ('title','authorname')
>     def authorname(self,obj):
>         return obj.author.name if obj.author else '-'
>     author_name.short_description = 'name'
>     author_name.admin_order_field = 'author__name'



Thanks !

Olivier

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAExk7p0sn%3D7j7LQJf3ALOhYo5uZgOdGGb_ycZKX5vYpd-OnPuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to