Opened 19 years ago
Closed 18 years ago
#2400 closed enhancement (fixed)
allow querying of existance of backwards relationship without resorting to custom sql
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | normal | Keywords: | qs-rf-fixed |
| Cc: | mattimustang@…, tyson@… | Triage Stage: | Accepted |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Both of these threads cover the same issue:
http://groups.google.com/group/django-users/browse_frm/thread/98b7aedf8f9d806c
http://groups.google.com/group/django-users/browse_frm/thread/b129d64b1ed77e28
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.
Change History (7)
comment:1 by , 19 years ago
| Cc: | added |
|---|
comment:2 by , 19 years ago
| Owner: | changed from to |
|---|
comment:3 by , 19 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:4 by , 18 years ago
| Keywords: | qs-rf added |
|---|
comment:5 by , 18 years ago
comment:6 by , 18 years ago
| Keywords: | qs-rf-fixed added; qs-rf removed |
|---|
comment:7 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
(In [7477]) Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
+1 Would be useful. Sign me up for this one.