title: How to display the values in a list from the database in flask?
body: <p>I have a problem I want to show values from my database to list but this does not work I have tried several methods and nothing still does not work.</p>
  
  <p><strong>Route</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>@app.route('/t',methods=['GET', 'POST'])
  def Consulta():
      g.con = pyodbc.connect('DRIVER={SQL Server}; SERVER=AUS_COMPUTO02\SQLEXPRESS; DATABASE=WEBSERVICE; Trusted_Connection = yes;')
  
      cur= g.con.execute("SELECT *FROM PROVEEDOR WHERE DECRIPCION  = '{}'".format('CHEF'))
      posts = [dict(ID_PROVEEDOR=row[0], DECRIPCION=row[1]) for row in cur.fetchall()] 
      g.con.close()
      print(posts)
      return render_template('consulta.html', posts=posts)
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>    &lt;from name="des" action="{url_for('t')}" method='POST'&gt;
  
          &lt;select  name="des" &gt;
         &lt;option value="{{ID_PROVEEDOR}}"&gt;{{ DECRIPCION }} &lt;/option&gt;
         &lt;option value="2"&gt;&lt;/option&gt;
  
          &lt;/select&gt;
  
          &lt;input type="submit"&gt;
  
           {% for p in post %}
  
          &lt;strong&gt;ID_PROVEEDOR:&lt;/strong&gt; {{ p.ID_PROVEEDOR }}
          &lt;strong&gt;DECRIPCION:&lt;/strong&gt; {{ p.DECRIPCION }} 
               {% endfor %} 
          &lt;/form&gt;
  </code></pre>