You cannot use the template language to verify what you think are constants; the parser actually tests 2 "literals".
The analyzer analyzes 2 literals with the names "No" and "False". When the parser tries to resolve them in context, a VariableDoesNotExist exception is thrown and both objects are resolved with the value python None and None == None.
from django.template import Context, Template t = Template("{% if None == False %} not what you think {% endif %}") c = Context({"foo": foo() })
prints u 'not what you think'
c = Context({'None':None}) t.render(c)
prints u 'not what you think'
c = Context({'None':None, 'False':False}) t.render(c)
prints u ''
source share