如何在html中动态命名标签,以便以后与它们相关联?

时间:2017-08-07 23:06:24

标签: html flask flask-wtforms

我应该如何在template.html中命名我的选择标记,以便能够在每次收到POST消息时在views.py中单独指出它们?

<div style="display: inline-block;">
    {% for type in range( form.typesCount ) %}
    <div>
       <select name="???">
          {% for format in formats %}
             <option value="{{format}}"> {{ format }}</option>
          {% endfor %}
       </select>
    </div>
    {% endfor %}
</div>

1 个答案:

答案 0 :(得分:1)

您可以使用loop.index,这是一个返回Jinja const path = require('path'); const webpack = require('webpack'); const basePath = path.normalize(__dirname + '/../../../../'); module.exports = { entry: [ './src/index.jsx' ], output: { filename: 'admin.bundle.js', publicPath: '/admin/dist/', path: path.resolve(basePath, 'web', 'admin', 'dist') }, plugins: [ new webpack.HotModuleReplacementPlugin(), ], module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, use: [ 'react-hot-loader', 'babel-loader', 'eslint-loader' ] }, { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }, { test: /\.(png|jpg)$/, use: [ { loader: 'url-loader', options: { limit: 40000 // 40 kB } } ] }, { test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/, loader: "file-loader" } ] }, resolve: { modules: [ path.resolve(__dirname, 'src'), 'node_modules' ], extensions: [ '.js', '.jsx' ] }, devServer: { hot: true, inline: true } }; 循环内当前迭代索引的整数。例如:

for