我有一个如下所示的列表
self.glb_data_list = [{'disp_type': '2'}]
我想分配这个' disp_type'值为wtform下拉字段' disp_type'。这是我的wtforms字段
disp_type = fields.SelectField(u'Preset Mapping',
choices=[(0, u'Custom'),
(1, u'Loopback'),
(2, u'All_East'),
(3, u'All_Wast'),
(4, u'16_East_16_West'),
(5, u'8_East_8_West'),
(6, u'STM1_East')],
coerce=int, default=0)
有人可以指导我如何分配
答案 0 :(得分:0)
self.glb_data_list = {'disp_type': 2}
disp_type = fields.SelectField(u'Preset Mapping',
choices=[(0, u'Custom'),
(1, u'Loopback'),
(2, u'All_East'),
(3, u'All_Wast'),
(4, u'16_East_16_West'),
(5, u'8_East_8_West'),
(6, u'STM1_East')],
coerce=int, default=0)
disp_type.data = self.glb_data_list['dist_type']