﻿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
743	new-admin: lookup_val2 not defined in BooleanFieldFilterSpec of django.contrib.admin.views.main	Tom Tobin <korpios@…>	rjwittams	"When attempting to filter on a boolean value in the new-admin admin interface, the following exception is thrown:

{{{
TemplateSyntaxError:   While rendering at admin/filters, line 3 , caught exception:
  NameError: global name 'lookup_val2' is not defined
}}}

In `django.contrib.admin.views.main`, the value `lookup_val2` is not defined on line 194 in the `output` method of class `BooleanFieldFilterSpec` (at the equality test '''`lookup_val2 == 'True'`'''):

{{{
#!python
    def output(self, cl):
        t = []
        t.append(_('<h3>By %s:</h3><ul>\n') % self.field.verbose_name)
        for k, v in (('All', None), ('Yes', '1'), ('No', '0')):
            t.append('<li%s><a href=""%s"">%s</a></li>\n' % \
                (((self.lookup_val == v and not self.lookup_val2) and ' class=""selected""' or ''),
                cl.get_query_string( {self.lookup_kwarg: v}, [self.lookup_kwarg2]), k))
        if isinstance(self.field, meta.NullBooleanField):
            t.append('<li%s><a href=""%s"">%s</a></li>\n' % \
                (((lookup_val2 == 'True') and ' class=""selected""' or ''),
                cl.get_query_string( {self.lookup_kwarg2: 'True'}, [self.lookup_kwarg]), 'Unknown'))
        t.append('</ul>\n\n')
        return """".join(t)
}}}

It seems that changing `lookup_val2` to `self.lookup_val2` solves this issue.
"	defect	closed	contrib.admin		normal	fixed			Unreviewed	0	0	0	0	0	0
