【发布时间】:2018-10-02 14:08:47
【问题描述】:
我正在尝试让我的烧瓶应用程序显示我的数据库中存储在 csv 中的类别列表。类别列存在于我调用列表的 CSV 中,然后尝试显示在引导下拉按钮上。来自烧瓶:
@app.route('/')
def test():
data= df['categories'].tolist()
return render_template('test.html', data= data)
从那里,我获取变量数据并将其注入 Bootstrap 下拉菜单按钮:
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<select name= "datum" method="GET" action="/">
{% for datum in data[1:] %}
<option value= "{{datum}}">{{datum}}</option>"
{% endfor %}
</select>
<a class="dropdown-item" href="#">{{data}}</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
第一个按钮是我想要的,但它是按钮中的一个按钮。当我单击它时它也会消失并且没有任何输入。
【问题讨论】:
标签: html css twitter-bootstrap flask