<form method="POST" action=/host/add/>
<input id="csrf_token" name="csrf_token" type="hidden" value="IjIyZDIzZTc5ZDlhNDE1NmJlMzc1ZjM1ZGVjNzIzNjA1ZjYwNDJiOGIi.XUL4Ig.MVof2EpiqTaH3a3ke8ydSM0J-_A">
<div class="row" id="box">
<div class="col">
<div class="form-group col-sm-10">
<label for="host">Rule Host</label>
<input class="form-control" id="host" name="host" placeholder="Rule Host" required type="text" value="">
</div>
<div class="form-group col-sm-10">
<label for="regex_uri">Regex Uri</label>
<input class="form-control" id="regex_uri" name="regex_uri" placeholder="Regex Uri" type="text" value="">
</div>
<div class="form-group col-sm-10">
<label for="regex_ua">Regex UA</label>
<input class="form-control" id="regex_ua" name="regex_ua" placeholder="Regex UA" type="text" value="">
</div>
</div>
</div>
</form>
post提交到view试图后;
通过 form.data 获取到inut所有表单的值;
得到结果为字典
{'host': '1', 'regex_uri': '', 'regex_ua': ''}
data = form.data
我直接
db.session.add(data)
这个data不能直接用。
db.session.add(host='qq.com',regex_uri='ccc',..........)
这样才可以,请问应该怎么处理?如果很多表单怎么办?