25👍
✅
Django admin is really flexible, you can simply add a helper method for it.
class PersonAdmin(admin.ModelAdmin):
list_display = ('name', 'books')
def books(self, obj):
return ",".join([k.name for k in obj.book_set.all()])
6👍
Add an inlinemodel admin
class BookInline(admin.TabularInline):
model = book
class PersonAdmin(admin.ModelAdmin):
inlines = [BookInline, ]
That should cover it.
Source:stackexchange.com