0
时存储POST变量的方法是使用表单搜索附近的学校并将其显示为表格。使用django
内views.py
def method1: printquery = request.POST.copy() zip = printquery['zip'] if not zip: city = printquery['city'] state = printquery['state'] zip = getZip(city,state) results = zipObj.getSchools(zip); render_to_response('some.html',{'results':results,'query':printquery,})
内模板
<form id="print-search" target="_blank" action="" method="post" name="print">
<input type="hidden" value="{%if query%}{{query}}{%endif%} name="query"/>
<input type ="submit" value="Print the Results" name="submitPrint"/>
</form>
<table>
{% block xxx%}displays schools result {%endblock%}
</table>
当 “打印结果” 按钮clicked.I要使用 '查询', 做再次搜索并在单独的页面中打印[我没有选择存储在会话ID中]。 我面临的问题是,{{query}}
是一个字符串的图灵,即u"{'zip': u'76123'"}
我不能做类似query['zip']
, 有没有办法解决这个问题。想法是最受欢迎的。