Opened 16 months ago
Last modified 16 months ago
#35746 closed Cleanup/optimization
make the form.cleaned_data attribute of form available in the __init__ — at Version 1
| Reported by: | piscvau | Owned by: | |
|---|---|---|---|
| Component: | Forms | Version: | 5.0 |
| Severity: | Normal | Keywords: | clean_field_name, form.full_clean |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hello
form.clean_field_name functions have no parameter passed to it as indicated in the documentation and need to access the form.cleaned_data dictionary. However this cleaned_data dictionary is not created in the __init__ of the form but only in the full_clean method of the form.
the need:
in the form.__init__, add closure functions as clean_field_name functions and use the cleaned_data dictionary as a free variable of this closure function. However this is not possible because the cleaned_data_dictionary is not yet created.
Suggested patch :
create the cleaned_data.attribute in the __init__ instead of the full_clean