Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a few things wrong here:</p> <p>First, when you call <code>render_template('chooser.html')</code>, you are never passing any arguments to the template rendering process. By default, Jinja2 does not error out if an attribute your reference is not found, so you get no error message. Basically, for the code in your template that looks like this:</p> <pre><code>{% for o in option_list %} .... {% endfor %} </code></pre> <p>The innards of this for loop are never rendered because you never specify what <code>option_list</code> is. In this case, Jinja2 will just default it to an empty string, and then you are essentially looping over the characters of the empty string (which of course means the innards of the for-loop are never run).</p> <p>So, you need to specify the template what the value of <code>option_list</code> is:</p> <pre><code>return render_template('chooser.html', option_list=option_list) </code></pre> <p>The other issue is that your HTML is going to be messed up due to where you've put your for loop:</p> <pre><code>&lt;select name="option" width="300px"&gt; {% for o in option_list %} &lt;option value="{{ o.optid }}" SELECTED&gt;{{ o.optid }}&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td&gt; &lt;input class="button1" type="submit" value="Select"&gt; &lt;/td&gt; {% endfor %} </code></pre> <p>I think you wanted to do the following:</p> <pre><code>&lt;select name="option" width="300px"&gt; {% for o in option_list %} &lt;option value="{{ o.optid }}" SELECTED&gt;{{ o.optid }}&lt;/option&gt; {% endfor %} &lt;/select&gt; &lt;/td&gt; &lt;td&gt; &lt;input class="button1" type="submit" value="Select"&gt; &lt;/td&gt; </code></pre> <p>See the <a href="http://flask.pocoo.org/docs/quickstart/#rendering-templates" rel="noreferrer">rendering part of the tutorial</a>, or the <a href="http://jinja.pocoo.org/docs/" rel="noreferrer">Jinja2 documentation</a> for more info.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload