Newbie here, been writing Python scripts for little bit more than 6 months. I'm trying to populate a wtf SelectField with a list, returned from a function that fetches the data f
Solution 1:
You unnecessarily create string in for loop in get_channels_list function.
Change it to this:
for i in a['channels']:
list1.append((i['name'], '#' + i['name']))
or to be even more pythonic:
return [(i['name'], '#' + i['name']) for i in a['channels']]
HTML with working form:
Share
Post a Comment
for "Flask - Populate Selectfield Choices With Array"
Post a Comment for "Flask - Populate Selectfield Choices With Array"