Связывание SQL с Python и отображение данных в HTML. Мне нужна ваша помощь, где я ошибаюсь? - PullRequest
0 голосов
/ 07 августа 2020

Мой HTML: https://pastebin.com/hyfv8yTW

     {% block main %}
        <table class="table">
            <thead class="thead-dark">
               <tr>
                   <th scope="col">Food</th>
                   <th scope="col">Food Freshness</th>
                   <th scope="col">Feed this number of people</th>
                   <th scope="col">Pick up time</th>
                   <th scope="col">Address</th>
              </tr>
           </thead>
           <tbody>
         {% for r in req %}
               <tr>
                 <th scope="row">{{ r[0] }}</th>
                 <td>{{ r[1] }}</td>
             <td>{{ r[2] }}</td>
             <td>{{ r[3] }}</td>  
             <td>{{ r[4] }}</td>  
            </tr>
      {% endfor %}
        </tbody>
    </table>
{% endblock %}

Это мой python код: https://pastebin.com/EhsaAwi8

@app.route("/index1")
@login_required
def index1():
    rows = db.execute("SELECT * FROM req WHERE user_id = :user",user=session["user_id"])
    req = []
    for row in rows:
       req.append(list((row['food'], row['foodf'], row['nosofp'], row['timep'], row['address'])))

    return render_template("index1.html", req=req)

Проблема с телом, голова видна нормально.

...