jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
801 stars 135 forks source link

get_form_step_data() returns form.data and not form.cleaned_data #120

Open ptink opened 6 years ago

ptink commented 6 years ago

Something puzzling about the way this is handled. As per the documentation get_form_step_data is specified as the place to manipulate the form data. However the default implementation:

def get_form_step_data(self, form):
    return form.data

Returns a forms data attribute and not cleaned_data. data is a QueryDict immutable by default and so to modify the data you have to copy the QueryDict (or set the data._mutable flag to True temporarily, which seems like a bit of a hack). I think the documentation should be updated to take this into account if this is not a bug.

muffinmad commented 4 years ago

Data returned by form's clean method are not saved to storage. So any changes to cleaned_data is lost.