Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

How to populate dropdown on loading through flask?

$
0
0

What i have tried:
Here is my test.html which gets options(list) from test.py

<select>
            <div class="test">
                <option selected="selected"> Select </option>
                {% for option in options %}
                <option value="{{ option }}">{{ option }}</option>
                {% endfor %}
            </select>
                </div>    

test.py

            @app.route('/test', methods=["GET"])
            @login_required
            def transactions_view():
                options = ["0","7","14","30"]
                return render_template("test.html", options=options)

Is there any other ways to update the dropdown?

The above html and py file gives the dropdown required,
But i'm unable to assign select attribute to above html?


Viewing all articles
Browse latest Browse all 138192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>