hi folks.
I think I need some help thinking through how to implement some fairly gnarly form logic, and before I spend more time banging my head against a wall, I figured asking here might help.
Background
I’m working on an open source project, where we’re building a multi step form wizard that it takes some data from a series of other models, and allows users to run through a series of steps to confirm that data is either correct, or needs to be updated, before writing the updated version back to the original model.
We’ve been using the initial_data
method in django forms to prepopulate forms and formsets with data to allow a user to review it before either making the changes or accepting them as they are.
To make this concrete, you can see some code at the link below, in the class ProviderRequestWizardView
, and in particular, the code to generate our initial_data
using get_initial_dict()
on that object.
And later on using the done
One thing we’re finding though is that when we use django forms, only the data that has changed is being saved as we run through the wizard, when we have initial data.
This wizard works fine for when we use it to allow a user to submit entirely new information, (i.e. to run through a form wizard with no initial data being added), but when we’re workign with existing data, this is bad because at the end of the wizard, when we would save the information back to the original models, only the data that has been changed is persisted back to the models.
In our case, we want all the data to be saved though, no matter what - is there a simple way to override this behaviour so we do this?