I'm pretty new to google app engine, and have just finished reading through the getting started. So I started implementing a simple app on GAE and soon got an error saying "TemplateSyntaxError, "'if' statement improperly formatted"" when I simply rendered an html which uses if statement. I solved the problem it using ifequal statement instead, but this tutorial shows me using if statement in the index.html (http://code.google.com/appengine/docs/python/gettingstarted/templates.html)
Do I miss anything to use if statement in a template?
Thanks, Yoo
UPDATED:
Here is details of the error. I think Chris' answer will let me use "Smart" if tag though. I'll try to update Django version to 1.2 soon.
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 634, in __call__
handler.get(*groups)
File "C:\Store house\gae\community\src\community.py", line 24, in get
self.response.out.write(template.render(path, template_values))
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\template.py", line 72, in render
t = load(template_path, debug)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\template.py", line 100, in load
template = django.template.loader.get_template(file_name)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\loader.py", line 80, in get_template
template = get_template_from_string(source, origin, template_name)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\loader.py", line 88, in get_template_from_string
return Template(source, origin, name)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\__init__.py", line 158, in __init__
self.nodelist = compile_string(template_string, origin)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\__init__.py", line 174, in compile_string
return parser.parse()
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\__init__.py", line 273, in parse
compiled_result = compile_func(self, token)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\loader_tags.py", line 154, in do_extends
nodelist = parser.parse()
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\__init__.py", line 273, in parse
compiled_result = compile_func(self, token)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\loader_tags.py", line 132, in do_block
nodelist = parser.parse(('endblock', 'endblock %s' % block_name))
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\__init__.py", line 273, in parse
compiled_result = compile_func(self, token)
File "C:\Program Files\Google\google_appengine\lib\django_0_96\django\template\defaulttags.py", line 655, in do_if
raise TemplateSyntaxError, "'if' statement improperly formatted"
TemplateSyntaxError: 'if' statement improperly formatted
UPDATED 2:
According to this article(http://code.google.com/appengine/docs/python/tools/libraries.html#Django), current google app engine is already included Django 1.2 but current default version is 0.96, that's why I couldn't use if tag. To use the version 1.2, follow an instruction in the link above. Now, I can use "Smart" if tag. Thanks everyone :)