#35746: make the form.cleaned_data attribute of form available in the __init__
-------------------------------------+-------------------------------------
     Reporter:  piscvau              |                    Owner:  (none)
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Forms                |                  Version:  5.0
     Severity:  Normal               |               Resolution:
     Keywords:  clean_field_name ,   |             Triage Stage:
  form.full_clean                    |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sarah Boyce:

Old description:

> 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
> dictionnary. However this cleaned_data dictionnary 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 dictionnary as a free variable of this closure
> function. However this is not possible because the
> cleaned_data_dictionnary is not yet created.
>
> Suggested patch :
> create the cleaned_data.attribute in the __init__ instead of the
> full_clean

New description:

 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

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35746#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191d6a46abd-d0debd12-1031-4d2d-9f8a-89b8763119a8-000000%40eu-central-1.amazonses.com.

Reply via email to