allow querying of existance of backwards relationship without resorting to custom sql
|Reported by:||mattimustang@…||Owned by:||nobody|
|Cc:||mattimustang@…, tyson@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Both of these threads cover the same issue:
To summarize, I can get all Reporters who have associated Articles by doing:
Reporter.objects.filter(article__isnull = False)
But, I can't get Reporters who have *no* associated Article by doing:
Reporter.objects.filter(article__isnull = True)
as it returns an empty list, since the article property does not exist for
those Reporters, and thus, it can't even be null.
Furthermore, being able to do the same in limit_choices_to would be extremely useful.