Allow "bypassing" validation in newforms
|Reported by:||Owned by:||nobody|
|Cc:||cgrady@…||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
I'm trying to generate a preview page based on a temporary model that should be populated from a form. The idea here is to be able to reuse the same template code as is used for the real view of the model, so simply basing the preview on the raw form data won't cut it.
There are actual two problems here:
- There seems to be no way whatsoever to trick newforms into keeping the
cleaned_dataeven when a validation error is encountered. It's stubbornly delete the
newforms.models.save_instancechecks whether the form has errors, so it won't allow me to populate the model instance from the form, even if
For (1), I think there should be an option to not discard the
cleaned_data on errors. For (2), there should be an option to ignore validation errors. I'm attaching a patch that does this.