Html 烧瓶是否修剪<;数据列表>;项目?

Html 烧瓶是否修剪<;数据列表>;项目?,html,flask,jinja2,flask-wtforms,datalist,Html,Flask,Jinja2,Flask Wtforms,Datalist,在Flask中并使用Jinja2,我调用了一个数据列表,但出于某种原因,任何带有空格的选项都会被修剪,所以“番茄酱”会变成“番茄”。这是Flask正在做的事还是我把模板搞砸了 <!-- HOMEPAGE --> <form type="text" id="homeForm" class="centered" method="post" onsubmit="return false;"> {{ form.hidden_tag() }} <

在Flask中并使用Jinja2,我调用了一个数据列表,但出于某种原因,任何带有空格的选项都会被修剪,所以“番茄酱”会变成“番茄”。这是Flask正在做的事还是我把模板搞砸了

<!-- HOMEPAGE -->
<form type="text" id="homeForm" class="centered" method="post" onsubmit="return false;">
        {{ form.hidden_tag() }}
        <input type="text" id="homeInput" autocomplete=off list="topps" placeholder="Input here">
        <datalist id="topps">
            {% for top in topps %}
            <option value={{ top }}>
            {% endfor %}
        </datalist>
        <button type="submit" id="homeSubmit">Submit</button>
</form>

# ROUTES.PY #
@app.route('/', methods=['GET', 'POST'])
@app.route('/index', methods=['GET', 'POST'])
def index():
    form = ToppingsForm()
    topps = ["tomato sauce", "chilli flakes","something else"]
    return render_template('index.html', title='Home', form=form, topps=topps)

{{form.hidden_tag()}}
{topps%中的top为%1}
{%endfor%}
提交
#ROUTES.PY#
@app.route('/',方法=['GET','POST'])
@app.route('/index',方法=['GET',POST'])
def index():
form=ToppingsForm()
topps=[“番茄酱”、“辣椒片”、“其他东西”]
返回呈现模板('index.html',title='Home',form=form,tops=tops)
您的问题在于:

<option value={{ top }}>
<option value="{{ top }}" />