Я занимаюсь разработкой веб-сайта для интернет-магазина и хочу показать пользователям обзор их корзины, пока они заполняют свои платежные адреса и прочее. У меня есть корзина в другом каталоге, так как мне вывести эту корзину в форме html для оформления заказа?
Я пытался сделать то же самое, что и с моей корзиной. html, но это не работает. Как я могу это исправить?
Мой заказ. html:
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<!-- Bootstrap CSS -->
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
<!-- Custom styles for this template -->
<link href="./css/form-validation.css" rel="stylesheet" />
</head>
<div class="container">
<div class="row">
<body class="bg-white">
<div class="container">
<div class="py-5 text-center">
<img
class="d-block mx-auto mb-4"
src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg"
alt=""
width=""
height=""
/>
<h2>Checkout</h2>
</div>
<div class="row">
<div class="col-md-4 order-md-2 mb-4">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">Your cart</span>
<span class="badge badge-secondary badge-pill">{{ request.session.items_total }}</span>
</h4>
<ul class="list-group mb-3">
{% for item in cart.cartitem_set.all %}
<li
class="list-group-item d-flex justify-content-between lh-condensed"
>
<div>
<h6 class="my-0">{{ item.product.name }}</h6>
<small class="text-muted">Brief description</small>
</div>
<span class="text-muted">${{ item.product.price }}</span>
</li>
{% endfor %}
<li class="list-group-item d-flex justify-content-between bg-light">
<div class="text-success">
<h6 class="my-0">Promo code</h6>
<small>VCA101</small>
</div>
<span class="text-success">-$5</span>
</li>
<li class="list-group-item d-flex justify-content-between">
<span>Total (USD)</span>
<strong>${{ cart.total }}</strong>
</li>
</ul>
<form class="card p-2">
<div class="input-group">
<input
type="text"
class="form-control"
placeholder="Promo code"
/>
<div class="input-group-append">
<button type="submit" class="btn btn-secondary">Redeem</button>
</div>
</div>
</form>
</div>
<div class="col-md-8 order-md-1">
<h4 class="mb-3">Billing address</h4>
<form class="needs-validation" novalidate>
<div class="row">
<div class="col-md-6 mb-3">
<div class="content-section">
<form method="POST" action=''>
{% csrf_token %}
<fieldset class="form-group">
{{ address_form|crispy }}
</fieldset>
</form>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<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://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"
></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/holder/2.9.4/holder.min.js"
integrity="sha256-ifihHN6L/pNU1ZQikrAb7CnyMBvisKG3SUAab0F3kVU="
crossorigin="anonymous"
></script>
</body>
</div>
</form>
</div>
</div>
</div>
<footer class="py-5 bg-dark bottom">
<div class="container">
<p class="m-0 text-center text-white">Copyright © MyShop 2020</p>
</div>
<!-- /.container -->
</footer>
</html>
{% endblock %}