Opened 10 years ago
Closed 10 years ago
#22794 closed New feature (wontfix)
Using WizardForm with only one model
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | 1.6 |
Severity: | Normal | Keywords: | WizardForm |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In some cases the model for which you create a form has to many fields and using only one form will create a very long form which is not comfortable for the user. In this case I would to break the forms into more than one page, and for that I would like to use the WizardForm. The problem I encountered while using the wizardForm is that form has to have it's own modelForm, which makes me to have a form with only part of the model fields. If my fields are defined as not nullable, this scenario creates a problem in saving the object. For this there two solutions - either I create two models that are compatible to my forms and have a OneToOne relationship, either I have to change the save method in which I combine the data from the two forms. I chose the second option and had problems with the saving problems until I realized I have to override the save_instance procedure.
I think cases in which a model has many fields that will create a very long form are very common, and in this cases there is a need to use WizardForm in which each form represents only part of the model. There should be an easy way to handle this situation, maybe changing the save method of the wizard form and add the parameter construct, so we will be able to change it to true in the save method.
I'm not sure an implementation of this is going to be sufficiently simple and general enough for inclusion in Django itself. It you could provide some working code for idea, perhaps we could consider it.