I have a Character model and there is a Voice model in the Voice model and there is a character field that connects them. Like me in the admin, on the Character page, display all available Voice objects, for example, I have three Voice objects and I want to see a list of all Voice objects on the Character page.

1 answer 1

Use inlines :

 class VoiceAdmin(admin.StackedInline): model = Voice def get_readonly_fields(self, request, obj=None): return [f.name for f in self.model._meta.get_fields()] def has_add_permission(self, request, obj=None): return False def has_delete_permission(self, request, obj=None): return False class CharactedAdmin(admin.ModelAdmin): inlines = [VoiceAdmin] 
  • You probably did not understand a little what I want to achieve, I need not the ability to add new objects, but only the display of all the existing ones. - user250899
  • Corrected, made inline uneditable. - Sergey Gornostaev