I’m adding soft delete behavior to some related models in an existing Django app, including a many-to-many through model (with foreign keys plus a
role field). On each of the three models I’m inheriting an abstract model (
SoftDeletionMixin), which implements a custom
get_queryset method to filter out deleted objects. The problem I’m running into is that when the through relationship is marked as deleted, I see a discrepancy where the
get_queryset appears to be applied to the
RelatedManager (in my case
Title.titlecontributor_set), but not the
Title.contributors). So once a
TitleContributor instance is marked as deleted,
title.titlecontributor_set.count() == 0 but
title.contributors.count() == 1.
I’ve read through documentation on related manager inheritance, but I’m still confused by the relationship between these two managers and whether there’s a way to make them consistent.
Anyone have guidance with this?