хочу сделать интернет-магазин, но возникает проблема - я не могу отследить нажатие на кнопку добавить в корзину. Помогите это сделать
мой код:
from flask import render_template, Flask, request, url_for
app = Flask(__name__)
l_z = 6
l_all = 25
@app.route('/', methods=["GET", "POST"])
def gfg():
if request.method == "POST":
id_of_el = request.form.get("id")
print(id_of_el)
return render_template("main_page.html")
else:
return render_template("main_page.html")
if __name__ == "__main__":
app.run(host='0.0.0.0')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Главная страница</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="/">Интернет-магазин</a>
<div class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/login">Войти</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/signup">Зарегистрироваться</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/profile">Личный кабинет</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/payments">Тарифы</a>
</li>
</ul>
<br/>
</div>
</nav>
<form action="/main_page" method="post">
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="https://avatars.mds.yandex.net/get-mpic/2991631/img_id1226570703684834044.png/orig" width=90% height=90% alt="...">
<div class="caption">
<h3>Видеокарта MSI GeForce RTX 3060</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae, modi!</p>
<p><button class="btn btn-primary btn-buy" type="sumbit" id="1">Купить</button></p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="https://droidnews.ru/img/2020/june/nvidia-geforce-rtx-3080-mozhet-vyglyadet-tak-fany-sdelali-render-po-foto_08-06-20-13-48-07.jpg" width=92% height=92% alt="...">
<div class="caption">
<h3>Видеокарта NVIDEA GeForce RTX 3080</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae, modi!</p>
<p><button class="btn btn-primary btn-buy" type="sumbit" id="2">Купить</button></p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/192x200" alt="...">
<div class="caption">
<h3>Товар 3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae, modi!</p>
<p><button class="btn btn-primary btn-buy" type="sumbit" id="3">Купить</button></p>
</div>
</div>
</div>
</div>
</form>