Python 烧瓶窗体预填充仅显示第一个空白

Python 烧瓶窗体预填充仅显示第一个空白,python,html,forms,flask,render,Python,Html,Forms,Flask,Render,我正在使用dynamodb中的数据预填充表单。我将把所有内容作为呈现模板语句的一部分传入: return render_template('edit_ride_input.html', rideDate=item.get('ride_date'), rideLocation=item.get('ride_location'), rideLe

我正在使用dynamodb中的数据预填充表单。我将把所有内容作为呈现模板语句的一部分传入:

return render_template('edit_ride_input.html', 
                          rideDate=item.get('ride_date'),
                          rideLocation=item.get('ride_location'),
                          rideLevel=item.get('ride_level'),
                          rideCap=item.get('ride_cap'),
                          rideVis=item.get('ride_vis'),
                          rideRange=item.get('ride_range'),
                          rideReg=item.get('ride_reg'),
                          rideFuel=item.get('ride_fuel'),
                          rideLunch=item.get('ride_lunch'),
                          rideMeetLocation=item.get('ride_meet_location'),
                          rideMeetTime=item.get('ride_meet_time'),
                          rideUnloadTime=item.get('ride_unload_time'),
                          rideUnloadLocation=item.get('ride_unload_location'),
                          rideDescription=item.get('ride_description'))
然后,我在每个表单元素上使用value=属性来预填充数据:

<div class="form-group ">
    <label class="col-md-4 control-label" for="ride_date">*Date:</label>
    <div class="col-md-4">
        <input id="ride_date" name="ride_date" value={{rideDate}} type="text" placeholder="DD/MM/YYYY" class="form-control" required="" />
    </div>
</div>
<!-- Text input-->
<div class="form-group">
    <label class="col-md-4 control-label" for="ride_location">*Location:</label>
    <div class="col-md-4">
        <h1>{{rideLocation}}
        <input id="ride_location" name="ride_location" value= {{rideLocation}} type="text" placeholder="Where is the ride being held?" class="form-control input-md" required="">
    </div>

*日期:
*地点:
{{rideLocation}}
问题是,当呈现表单时,它只显示从变量到第一个空格的数据。例如,如果我输入值为“Nightcap国家公园”rideLocation,则输入字段中显示的所有内容都是“Nightcap”。我知道变量包含完整的字符串,因为当我在页面中直接将其呈现为{{rideLocation}}时,我看到“夜总会国家公园


我做错什么了吗

打字真的能让你思考,当我思考时,有时我的大脑真的能工作:)

我突然想到,当直接输入预填充值时,它们需要用引号括起来。我认为flask变量不会有什么不同,所以我也尝试用引号将它们括起来:

<div class="form-group ">
    <label class="col-md-4 control-label" for="ride_date">*Date:</label>
    <div class="col-md-4">
        <input id="ride_date" name="ride_date" value="{{rideDate}}" type="text" placeholder="DD/MM/YYYY" class="form-control" required="" />
    </div>
</div>
<!-- Text input-->
<div class="form-group">
    <label class="col-md-4 control-label" for="ride_location">*Location:</label>
    <div class="col-md-4">
        <h1>{{rideLocation}}
        <input id="ride_location" name="ride_location" value= "{{rideLocation}}" type="text" placeholder="Where is the ride being held?" class="form-control input-md" required="">
    </div>

*日期:
*地点:
{{rideLocation}}
你知道吗,成功了


希望这能在将来帮助其他人。

这是基本要求