Why would I ever use save(commit=False)
instead of just creating a form object from the ModelForm
subclass and running is_valid()
to v
Here it is the answer (from docs):
# Create a form instance with POST data.
>>> f = AuthorForm(request.POST)
# Create, but don't save the new author instance.
>>> new_author = f.save(commit=False)
The most common situation is to get the instance from form but only 'in memory', not in database. Before save it you want to make some changes:
# Modify the author in some way.
>>> new_author.some_field = 'some_value'
# Save the new instance.
>>> new_author.save()