#12105 closed (fixed)
Admin querystring __isnull=False filter doesn't work
| Reported by: | marcob | Owned by: | Gabriel Hurley |
|---|---|---|---|
| Component: | contrib.admin | Version: | 1.1 |
| Severity: | Keywords: | isnull filter | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
If I use __isnull=False with an admin querystring filter I always get a IS NULL query.
Try with:
http://127.0.0.1:8000/admin/auth/user/?email__isnull=False http://127.0.0.1:8000/admin/auth/user/?email__isnull=True
You'll get same results.
I fixed with a tiny patch (attached):
elif key.endswith('__isnull'):
value = False if value.lower() == 'false' else Tru
Attachments (2)
Change History (14)
comment:1 by , 16 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 16 years ago
| milestone: | → 1.2 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 16 years ago
| Needs tests: | set |
|---|---|
| Patch needs improvement: | set |
comment:4 by , 16 years ago
Better patch. It doesn't use inline and it keep working a previous workaround ( isnull= with a null value )
http://127.0.0.1:8000/admin/auth/user/?email__isnull=
by , 16 years ago
| Attachment: | isnull_false_filter.patch added |
|---|
comment:5 by , 16 years ago
| Owner: | changed from to |
|---|
Replying to marcob:
If I use
__isnull=Falsewith an admin querystring filter I always get a IS NULL query.
Try with:
http://127.0.0.1:8000/admin/auth/user/?email__isnull=False http://127.0.0.1:8000/admin/auth/user/?email__isnull=TrueYou'll get same results.
I fixed with a tiny patch (attached):
elif key.endswith('__isnull'): value = False if value.lower() == 'false' else Tru
by , 16 years ago
| Attachment: | 12105-r11858.diff added |
|---|
comment:6 by , 16 years ago
| Needs tests: | unset |
|---|---|
| Patch needs improvement: | unset |
comment:7 by , 16 years ago
| Needs tests: | set |
|---|---|
| Owner: | removed |
| Patch needs improvement: | set |
comment:8 by , 16 years ago
| Needs tests: | unset |
|---|---|
| Patch needs improvement: | unset |
comment:9 by , 16 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
Travis' patch looks good to me... seems like this one's in the bag. If anyone spots anything else about it I'll wrap it up.
comment:10 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Inline
ifisn't a feature of Python 2.4