[Answered ]-Saving Django ModelForms with Multiple Inheritance

2👍

Usually in Django such thing is being made by creating 3 separate forms and process them all in one view.

address_form = AddressForm(request.POST)
profile_form = UserProfileForm(request.POST)
contacts_form = ContactInfoForm(request.POST)
if address_form.is_valid() and profile_form.is_valid() and contacts_form.is_valid():
    address_form.save()
    profile_form.save()
    contacts_form.save()

Maybe it’s bit more code this way but it’s much more clear and easy to read.

👤ilvar

Leave a comment