Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

populating selectfield from json file

@app.route("/create", methods=['GET', 'POST'])
def create():
    form = CreateDelivery() 
    with open("..manufacturers.json", "r") as file:
            manu = json.load(file)
            form.manufacturer.choices = [(i['data'], i['name']) for i in manu['manufacturers']]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #populating #selectfield #json #file
ADD COMMENT
Topic
Name
8+2 =