﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15606	Django admin filter and Bool choices	django@…	nobody	"If I have such construction:

{{{
#!python
# models.py
class BoolTest(models.Model):
    NO = False
    YES = True
    YES_NO_CHOICES = (
        (NO, 'no'),
        (YES, 'yes')
    )
    completed = models.BooleanField(
        default=NO,
        choices=YES_NO_CHOICES

# admin.py
class BoolTestAdmin(admin.ModelAdmin):
    list_filter = ('completed',)
}}}

and I use filter results in Django admin, then this URL is generated (for `no` and `yes` choices):

.../admin/appname/booltest/?completed!__exact=False[[br]]
.../admin/appname/booltest/?completed!__exact=True

The !True/False is taken as string (not converted 'True' -> True and 'False' -> False), non empty strings in Python are considered as True, so the final SQL is for both choices:

SELECT `appname_booltest`.`id`, `appname_booltest`.`name`, `appname_booltest`.`completed` FROM `appname_booltest` WHERE `appname_booltest`.`completed` = 1  ORDER BY `appname_booltest`.`id` DESC

I think, that instead of !True/False there should be 0/1 in URL"		closed	contrib.admin	1.2		fixed		mir@…	Accepted	0	0	0	0	0	0
