I just found out today that you cannot stack an inline admin in another inline admin.
Here’s what I’m trying to do: I have textobjects and I want them to be multilingual. So let’s say there is a Textbody. It lives in contentmanager.models. The textbody model has no actual text. The actual text lives in multitext.models as Body. It has a foreign key relationship to Textbody, it has the actual text and a language. So you can for instance have a Textbody with an english and a italian Body. I use an InlineAdminModel to display them both and it works just fine. However, a textbody needs a context to live in.
In comes the top level app, it’s called eulogymanager. The eulogymanager manages eulogies (duh), and they have Textbodies. So I gave Textbodies a ForeignKeyField to Eulogy. I created an InlineModelAdmin for the both and ended up with an almost empty admin add page.
I tried out django-nested-admin and got it to work as I originally intended. However, I would like to better understand how I’m supposed to do it the Django way.
- Is it not intended to have such complex relationships between models in Django? Or am I making it unnecessarily complicated by bad desgin?
- My goal was to avoid writing my own forms and backend and use the Django Admin for everything. With some of the more complex models I have, I find it quite complicated to make the Django Admin work for me. Installing the additional package was something, I wanted to avoid but now I did it just to make the admin work. I’m thinking I might be better off just creating my own forms. I already spent a lot of time on django forms and the way I would do it is to just process the most inner child first, save it, get it’s key, pass that as the foreign key to the first parent, and so on untill I come out at the top. But ultimately I have no idea in which direction I should look, so a little guidance from someone with more experience would be well appreciated.