This uses the web application framework, not Django.
The following template code gives me the expression TemplateSyntaxError: 'for', containing five words, should end up with a reverseed error when trying to create a dictionary. I don't understand what causes this error. Can someone shed some light on this for me?
{% for code, name in charts.items %} <option value="{{code}}">{{name}}</option> {% endfor %}
I process it using the following:
class GenerateChart(basewebview): def get(self): values = {"datepicker":True} values["charts"] = {"p3": "3D Pie Chart", "p": "Segmented Pied Chart"} self.render_page("generatechart.html", values) class basewebview(webapp.RequestHandler): ''' Base class for all webapp.RequestHandler type classes ''' def render_page(self, filename, template_values=dict()): filename = "%s/%s" % (_template_dir, filename) path = os.path.join(os.path.dirname(__file__), filename) self.response.out.write(template.render(path, template_values))
python google-app-engine django django-templates
Phil
source share