Does Django automatically update child records when the master foreign key is updated? Can it be disabled.
I can see an on.delete function but not an on.update function in the Django docs.
/vfclistsGUY
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Django doesn’t touch the children at all unless you tell it to. Even in the case of DELETE CASCADE, that’s an enforcement on the database level, not in Django.
If you are using inline formsets for the children along with the main object’s form (or using inlines in the admin… same thing), then Django will update the children as well if there’s any changes to them. Otherwise, no, Django does nothing.
If you need to update the children on save, you should override your model’s
savemethod to do whatever needs to be done to the children, or use apost_savesignal.