Answer the question
In order to leave comments, you need to log in
Should I use cleaned_data when saving the form?
Here is an example from the doc:
if request.method == 'POST':
form = NameForm(request.POST)
if form.is_valid():
# process the data in form.cleaned_data as required
item = form.save(commit=False)
item.my_field = 'bla bla bla'
item.save()
Answer the question
In order to leave comments, you need to log in
Why do you think the object from POST is getting filled?
In request.POST, the data is not secure. POST - generally - readonly, and any garbage that came there from the client remains there. cleaned_data is the result of calling the cleanup and validation functions. And it is this data that is saved when you call save().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question