As referenced in #13, not all related objects should be deleted.
But I think that ForeignKey should resolve it by itself, using on_delete param. The same applies to OneToOneField.
But there is another case with inherited models.
Consider following case:
class BaseModel(LogicalDeleteModel):
name = models.CharField(default='Empty name', max_length=256)
class InhertedModel(BaseModel):
description = models.TextField(default='Some description')
In this case, when the instance of InhertedModel would be deleted, related objects will contain linked the instance of BaseModel and it's delete method will be called. Which collect instance of InhertedModel in related objects and call it's delete method.
So we will have endless recursion.
As referenced in #13, not all related objects should be deleted.
But I think that
ForeignKey
should resolve it by itself, usingon_delete
param. The same applies toOneToOneField
.But there is another case with inherited models. Consider following case:
In this case, when the instance of
InhertedModel
would be deleted, related objects will contain linked the instance ofBaseModel
and it'sdelete
method will be called. Which collect instance ofInhertedModel
in related objects and call it'sdelete
method. So we will have endless recursion.This commit fixes it