【Flask】jinja2根据url中的字符串,决定是否显示某个div
生活随笔
收集整理的這篇文章主要介紹了
【Flask】jinja2根据url中的字符串,决定是否显示某个div
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
HTML
{% if show_input_box %}<div style="padding:20px 60px 20px 60px"><form id="ff" action="/users_spreads_modify/" method="post"><table cellpadding="5"><tr><td>比例1</td><td><input class="easyui-textbox" type="text" name="mul_first"></input></td><td>比例2</td><td><input class="easyui-textbox" type="text" name="mul_second"></input></td></tr></table></form><div style="text-align:center;padding:5px"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a></div></div>{% endif %}view.py
@main.route('/example/', methods=[ 'GET','POST']) @login_required def example():full_path = request.full_pathshow_input_box = is_get_spreads_func(full_path)......return render_template('example.html', jsondata=json_last, timejson=timejson, show_input_box=show_input_box)例如,通過發送 GET 到 http://127.0.0.1:5000/test/a?x=1,
后臺輸出為
request.path: /test/a request.host: 127.0.0.1:5000 request.host_url: http://127.0.0.1:5000/ request.full_path: /test/a?x=1 request.script_root: request.url: http://127.0.0.1:5000/test/a?x=1 request.base_url: http://127.0.0.1:5000/test/a request.url_root: http://127.0.0.1:5000/總結
以上是生活随笔為你收集整理的【Flask】jinja2根据url中的字符串,决定是否显示某个div的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Python】判断字符串中是否含有某个
- 下一篇: 【EasyUI】DataGrid实现表格