Flask python modal window

3 день не могу решить проблему связанную с Flask. Мне нужно что бы функция verification находилась на той же странице что и функция home_detail и брала данные с quantity_order и потом отображала сумму в модельном окне как вот тут:

app.py:

@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
    username = request.form['username']
    password = request.form['password']

    user = User.query.filter_by(username=username).first()

    if not user or not check_password_hash(user.password, password):
        flash('Проверьте свой логин или пароль', 'error')
        return redirect(url_for('login'))

    flash('Вы успешно вошли!', 'info')
    login_user(user)
    return redirect(url_for('home'))

if current_user.is_authenticated:
    return render_template('home.html', username=current_user.username)
else:
    return render_template('home.html')

home.html:

<div class="col-md-3 text-end">
            <button type="button" class="btn btn-success fw-bold fs-6" data-bs-toggle="modal" data-bs-target="#login">Войти</button>
          </div>

      <div class="modal fade" tabindex="-1" id="login" aria-labelledby="login" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content rounded-4 shadow">
          <div class="modal-header p-5 pb-4 border-bottom-0">
            <h1 class="fw-bold mb-0 fs-2">Войти</h1>
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
          </div>

          <div class="modal-body p-5 pt-0">
            <form method="POST" action="{{ url_for('login') }}">
              <div class="form-floating mb-3">
                <input type="text" class="form-control rounded-3" name="username" id="username" placeholder="username">
                <label for="username">Логин</label>
              </div>
              <div class="form-floating mb-3">
                <input type="password" class="form-control rounded-3" name="password" id="password" placeholder="Password">
                <label for="password">Пароль</label>
              </div>
              <button class="w-100 mb-2 btn btn-lg rounded-3 btn-success" type="submit">Войти</button>
            </form>
          </div>
        </div>
      </div>
      </div>

Как это должно выглядеть(Как это выглядит показано на скриншоте)

Но при попытке сделать так же на странице с динамическим адресом типа: http://127.0.0.1:5000/home/2 (где 2 зависит от номера карточки) у меня либо выбивает ошибки, либо создаётся новая страничка типа: http://127.0.0.1:5000/home/2/verification на которой отображается id карточки и белый фон.

Вот код в app.py который выдаёт белую страничку:

@app.route('/home/<int:id>', methods=['GET','POST'])
@login_required
 def home_detail(id):
 products = Product.query.get(id)
 orderid = (''.join(random.choices(string.digits, k=10)))
 return render_template('home_detail.html', username=current_user.username, 
 products=products, bankid=current_user.bankid, id=id, orderid=orderid), product_id


@app.route('/home/<int:id>/verification', methods=['GET','POST'])
@login_required
def verification(id):
  products = Product.query.get(id)
  id = id
  quantity_order = 1
  if request.method == 'POST':
    quantity_order = request.form['quantity_order']
    return quantity_order
  a = int(quantity_order)
  b = int(products.price)
  summa = (a*b)
  return render_template('verification.html', username=current_user.username, 
  products=products, bankid=current_user.bankid,id=id, summa=summa)

Вот код в home_detail.html:

<div class="container-sm">
  <div class="row g-5">
    <div class="col-md-5 col-lg-4 mt-5 order-md-last">
      <div class="position-sticky" style="top: 2rem;">
        <div class="shadow p-3 mb-4 bg-body-tertiary rounded">
            {% if products.currency == 'Железо' %}
            <h1 class="mb-3 fw-bold text-center">
              {{products.price}}<img src="\static\iron-ingot.png">
            </h1>
            {% endif %}
            {% if products.currency == 'Алмазы' %}
            <h1 class="mb-3 fw-bold text-center">
              {{products.price}}<img src="\static\diamond.png">
            </h1>
            {% endif %}
          <form method="POST" action="{{ url_for('verification', id=products.id) }}">
            <div class="form-floating mb-3">
              <input type="text" class="form-control rounded-3" name="quantity_order" id="quantity_order" placeholder="quantity_order" value="1">
              <label for="quantity_order">Количество</label>
            </div>
            <button class="w-100 mb-2 btn btn-lg rounded-3 btn-success" type="submit" data-bs-toggle="modal" data-bs-target="#pay">Купить</button>
          </form>
          <p class="mb-0">В наличии: {{products.quantity}} шт.</p>
          <p class="mb-0">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-shop" viewBox="0 0 16 16">
                <path d="M2.97 1.35A1 1 0 0 1 3.73 1h8.54a1 1 0 0 1 .76.35l2.609 3.044A1.5 1.5 0 0 1 16 5.37v.255a2.375 2.375 0 0 1-4.25 1.458A2.371 2.371 0 0 1 9.875 8 2.37 2.37 0 0 1 8 7.083 2.37 2.37 0 0 1 6.125 8a2.37 2.37 0 0 1-1.875-.917A2.375 2.375 0 0 1 0 5.625V5.37a1.5 1.5 0 0 1 .361-.976l2.61-3.045zm1.78 4.275a1.375 1.375 0 0 0 2.75 0 .5.5 0 0 1 1 0 1.375 1.375 0 0 0 2.75 0 .5.5 0 0 1 1 0 1.375 1.375 0 1 0 2.75 0V5.37a.5.5 0 0 0-.12-.325L12.27 2H3.73L1.12 5.045A.5.5 0 0 0 1 5.37v.255a1.375 1.375 0 0 0 2.75 0 .5.5 0 0 1 1 0M1.5 8.5A.5.5 0 0 1 2 9v6h1v-5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v5h6V9a.5.5 0 0 1 1 0v6h.5a.5.5 0 0 1 0 1H.5a.5.5 0 0 1 0-1H1V9a.5.5 0 0 1 .5-.5M4 15h3v-5H4zm5-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zm3 0h-2v3h2z"></path>
              </svg>
            {{products.author}}
          </p>
          <p class="mb-0">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-seam" viewBox="0 0 16 16">
                <path d="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2zm3.564 1.426L5.596 5 8 5.961 14.154 3.5zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z"/>
              </svg>
            Доставка за 1 день!
          </p>
        </div>
      </div>
    </div>
    <div class="col-md-7 col-lg-8 card border bg-body-tertiary shadow">
        <h1 class="mb-3 fw-bold mt-3">{{products.title}}</h1>
        <div class="mb-4 text-center">
          <img src="{{products.img}}" class="rounded" width="550" height="550">
        </div>
        <hr>
        <h4 class="mb-2 fw-bold">Описание:</h4>
        <p class="mb-0 fs-5">{{products.text}}</p>
    </div>
  </div>
</div>


<div class="modal fade" tabindex="-1" id="pay" aria-labelledby="pay" aria-hidden="true">
<div class="modal-dialog" role="document">
  <div class="modal-content rounded-4 shadow">
    <div class="modal-header p-5 pb-4 border-bottom-0">
      <h1 class="fw-bold mb-0 fs-2">FARMA PAY</h1>
      <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    </div>
      <div class="modal-body p-5 pt-0">
        <h5 class="mb-3 fw-bold">Вы покупаете: <a class="mb-3 fw-bold text-decoration-none" href="{{id}}">{{products.title[0:21]}}</a></h5>
        <h5 class="mb-3 fw-bold">Ваш BankID: {{bankid}}</h5>
        {% if products.currency == 'Железо' %}
        <h5 class="mb-3 fw-bold">
          Цена: {{products.price}}<img src="\static\iron-ingot.png" height="20">
        </h5>
        {% elif products.currency == 'Алмазы' %}
        <h5 class="mb-3 fw-bold">Цена: {{products.price}}<img src="\static\diamond.png" height="20"></h5>
        {% endif %}
      </div>
  </div>
</div>
</div>

Заранее благодарю


Ответы (0 шт):