Skip to content
Advertisement

Django UpdateView with three different modelforms

I have a django UpdateView which needs to inherit three different models and different models. CreateView is working fine with three different modelforms.

models.py:

JavaScript

views.py:

JavaScript

WHen I go to Update view, I am only able to update EmployeeAddModelForm values. But other form’s(WorkExperienceForm, EducationForm ) fields do not appear let alone edit the values of the fields. I suppose my views.py is not correct. I need suggestion to correct my updateview.

Advertisement

Answer

If you want to put multiple forms in one HTML file, in my way, write as follows.

JavaScript

I think the argument of each form depends on the definition of Form.

And in a very simple way, the HTML file looks like this:

JavaScript

I’m not sure if this is the best option.

Advertisement