Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#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 Alex Gaynor)

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)

isnull_false_filter.patch (689 bytes ) - added by marcob 15 years ago.
12105-r11858.diff (2.5 KB ) - added by Travis Cline <travis.cline@…> 15 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Alex Gaynor, 15 years ago

Description: modified (diff)

comment:2 by Jacob, 15 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:3 by Chris Beaven, 15 years ago

Needs tests: set
Patch needs improvement: set

Inline if isn't a feature of Python 2.4

comment:4 by marcob, 15 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 marcob, 15 years ago

Attachment: isnull_false_filter.patch added

in reply to:  description comment:5 by mikepenn, 15 years ago

Owner: changed from nobody to mikepenn

Replying to marcob:

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

by Travis Cline <travis.cline@…>, 15 years ago

Attachment: 12105-r11858.diff added

comment:6 by Travis Cline <travis.cline@…>, 15 years ago

Needs tests: unset
Patch needs improvement: unset

comment:7 by mikepenn, 15 years ago

Needs tests: set
Owner: mikepenn removed
Patch needs improvement: set

comment:8 by mikepenn, 15 years ago

Needs tests: unset
Patch needs improvement: unset

comment:9 by Gabriel Hurley, 15 years ago

Owner: set to Gabriel Hurley
Status: newassigned

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 Karen Tracey, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [12795]) Fixed #12105: Corrected handling of isnull=False lookups in admin. Thanks marcob, Travis Cline, gabrielhurley.

comment:11 by Karen Tracey, 15 years ago

(In [12796]) [1.1.X] Fixed #12105: Corrected handling of isnull=False lookups in admin. Thanks marcob, Travis Cline, gabrielhurley.

r12795 backport from trunk.

comment:12 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top