2👍
I had the same issue and I managed to do it. I don’t know if it’s exactly what you need but let me know if it’s not I’ll remove my answer.
You can do it like that:
Admin.py
from django.contrib import admin
from myapp2 import models
class TabularInlineC(admin.TabularInline):
model=models.C
class TabularInlineB(admin.TabularInline):
model=models.B
class AdminA(admin.ModelAdmin):
inlines=[TabularInlineB, TabularInlineC ]
admin.site.register(models.A, AdminA)
That will render two inlines having each a section in the admin page of model A. Note that in this code, both model B and Model C have foreign key to model A. Indeed, this is not exactly the same pattern you are using in your question but it is, in my opinion, the simplest way of achieving what you want. The fact that you point two models to the same, allow you to consider this Model has the parent model. So, if you can find a common field to point to, you will be able to add two inlines in the same form since both models will have a link to Model A.
Also, another interesting thing you can do is add classes = ['collapse']
to both class TabularInlineB
and class TabularInlineC
this will allow collapsable on those two sections of your admin page.
Hope it helps !
EDIT
If you absolutely need to render only one inline that include both models, I’m also not sure if it is possible out of the box with Django.