Unable to save forms to the database for inline formsets using form wizard

39 views
Skip to first unread message

Vishal Vincent

unread,
Dec 2, 2017, 3:02:55 PM12/2/17
to Django users

I am currently working on building a survey. The parent model 'Person' is linked to a 'Question' model via ManytoMany relationship. Both Question and Person model are linked to an 'Answer' model via foreign key.


Currently, I am having issues using the Form Wizard which consists of two steps: First step is the Person form and the second step is the form consisting of an inline formset linking the Person and Answer model.


On saving the forms to the database in the 'done' function of the wizard, I seem to be getting the error "save() prohibited to prevent data loss due to unsaved related object 'person."


I guess this error is due to the foreign key relationship between Person and Answer models but I am unclear on how to implement this in the WizardView.


Thanks in advance for any help provided.


Reply all
Reply to author
Forward
0 new messages