Django says if form.is_valid()
is True
. form.cleaned_data
is where all validated fields are stored. But I am confused about using the cleaned_data
function.
form.cleaned_data['f1']
-- cleaned data
request.POST.get('f1')
-- un-validated data
I have a model form in Django.
if form1.is_valid():
form1.save()
Does this save cleaned_data to the model or does it save unvalidated data.
form2=form1.save(commit=False);
Does form2 contain form1's cleaned_data or unvalidated data.
Apart from converting any date to python datetime object, is there a good example of benefit of using cleaned_data vs unvalidated data. Thanks