B
B
Bjornie2018-07-29 15:57:12
Django
Bjornie, 2018-07-29 15:57:12

How to include fields from the inherited model in the form?

The question is partly related to this topic: How to access model B which inherits from A?
I want to display a form of model A (main model) with fields from model B (which inherits from A).
At the moment, fields from model B are displayed in the form, but they do not display or save data from model B. If I change the form in view to model B, then everything works, but this method does not suit me.
As far as I understand, the easiest way is to display two forms from different models inside the same form tag, add different prefixes to them and save them separately. What say developers?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question