I'm trying to use Django forms in my Google App Engine project, using the template system. However I can't figure out how to get forms to be rendered properly. When calling form.as_p () from python code I get the expected html,
<p><label for="id_name">Name:</label> <input type="text" name="name" id="id_name" /></p>
yet when calling form.as_p from the template I instead get
<p><label for="id_name">Name:</label> <input type="text" name="name" id="id_name" /></p>
Here is my render method
def render(self, name, **data):
"""Render a template"""
if not data:
data = {}
self.response.out.write(template.render(
os.path.join(
os.path.dirname(__file__), 'templates', name + '.html'),
data))
Render method being called:
form = PostForm()
self.render('toplevel', parent=user, items=user.establishments(), form=form)
And finally the template:
{% block content %}
{{ form.as_p }}
{% endblock content %}