Closed foucdeg closed 3 years ago
Hi, @foucdeg !
Currently, the cascade deletion is not changed and it works as the Django standard functionality.
Soft-deletion works only with the models, you specifically inherit with the SoftDeleteModel
class. This library overrides the model's delete
method and the model queryset's delete
method.
So the child does get physically deleted. It's probably a good thing to document.
Thanks! It's a good remark. I have documented it already.
How about this?
class MyParent(SoftDeleteModel):
# whatever
class MyModel(SoftDeleteModel):
parent = models.ForeignKey(MyParent, on_delete=models.CASCADE)
I tried to soft delete the parent yet the child model is not soft deleted. How to soft delete the child model by soft deleting the parent ?
How about this?
class MyParent(SoftDeleteModel): # whatever class MyModel(SoftDeleteModel): parent = models.ForeignKey(MyParent, on_delete=models.CASCADE)
I tried to soft delete the parent yet the child model is not soft deleted. How to soft delete the child model by soft deleting the parent ?
Facing same problem
I'm facing the same problem here, should I use the Signal and handle it myself?
I have this model:
What happens if I delete a Parent which has children MyModel? Does the child get physically deleted, or soft deleted and the foreign key set NULL?