Search code examples
djangodjango-modelsdjango-model-field

What is the meaning of "Model.delete() isn't called on related models" in Django Doc


I was reading Django's article on model fields and models.CASCADE. I don't understand this phrase:

Model.delete() isn’t called on related models

models.CASCADE means that related objects to delete when the target object deleted ,so what is the meaning of "isn't called on related models"?

Please explain that for me.


Solution

  • If your read the part after its maybe more clearly but the pre_delete and post_delete signals are sent for all deleted objects. So what this means is Django will delete the objects but won't call the delete method of those objects -and delete them by delete_batch method-. It will only fire the pre_delete and post_delete signals for that object.