对象html中的Flask资源

时间:2017-06-15 20:20:13

标签: python html flask

我在/ statistics / id。

我在烧瓶视图中有一个资源:

@app.route('/statistics2/<int:id>', methods=['GET', 'POST']):
     quotation_title = db.get_quotation_by_session_parameter(id, 'number_questions')
     return render_template('statistics2.html', quotation_title = quotation_title)

我想在我的对象html标签中调用此资源。

我这样做:

<object id="content" type="text/html" width="100%" height="100%" data="statistics" ></object>

在数据属性中,我想指出统计信息/ ID,但我不知道如何检索当前ID

例如:使用id 6,我在/ statistics / 6中,我想在数据属性statistics2 / 6中的对象html中显示。

我该怎么做?

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

您可以从传递给模板的id变量中获取quotation_title

{{ quotation_title.id }}

一样