Emmanuel Mtali
Emmanuel Mtali

Reputation: 4963

In what sequence Model.save() and ModelForm.save() called

I understand that both models.Model and forms.ModelForm both contain .save() method that you can override. My question is how and when are they used to save an object and in what sequence.

Upvotes: 2

Views: 59

Answers (1)

GwynBleidD
GwynBleidD

Reputation: 20559

ModelForm.save() is called first and it is calling Model.save() internally.

Method in ModelForm is an helper to build or update Model object from data provided in form and save it to database. It also saves any many to many or reversed foreign key relations.

Upvotes: 2

Related Questions