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 ManyRelatedManager (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.
I think it’s likely that we would need to see the models and managers involved here - or at least a minimal-working example demonstrating the issue. There are so many things that could be wrong that it would be nearly impossible to guess in the absence of the actual code being used.