Join GitHub today
get() and filter() on related fields #4
There seems to be a problem with filter and get when referencing objects that are related, for example via a ForeignKey.
Imagine you have an Organization that is associated with multiple Groups (that is, in the Group model we have a ForeignKey that points to Organization). In the DB we have an organization named "My Organization", another one named "My Organization 2" and each of those have a (different) associated group called 'root', so there are actually two groups with the same name.
In this code:
We tracked down the problem and it seems the all_with_deleted() function in SoftDeleteManager is not applying the "core" filtering the RelatedManager is responsible for doing, so it is actually working over the entire DB and not the "org" QuerySet.