python 2.7.11 and django 1.9 I run the code in "python manage.py shell"
Django 1.9 In[2]: import django In[3]: from django.template import Template, Context In[4]: t = Template("{% if x and x.strip %}OK{% else %}Empty{% endif %}") In[5]: t.render(Context({})) 2015-12-17 14:13:43,443 [MainThread:3140] [django.template:923] [base:_resolve_lookup] [DEBUG]- Exception while resolving variable 'x' in template 'unknown'. Traceback (most recent call last): File "D:\Python27\lib\site-packages\django\template\base.py", line 901, in _resolve_lookup (bit, current)) # missing attribute VariableDoesNotExist: Failed lookup for key [x] in u"[{'False': False, 'None': None, 'True': True}, {}]" Out[5]: u'Empty' I use "if" in template,but it has excepiton. Is it an bug? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/21ae6cc2-7ef3-4638-b0a7-6ce5bfaffcbf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.