Returns an error after going to the 'cart' tab, reverse for 'cart_detail' not found

I create a website where users can place orders without payment. The assumption is that the user selects the products, then in cart after pressing the 'Order' button. He must provide data for the order.

My form is not saved in the Order table. I have no complete idea. Can anybody see what I'm missing?

Before adding 'if' in views.py, it was possible to go to the cart. However, I have a problem creating the order.

From this moment if request.method == 'POST': until this point return

redirect('cart:cart_detail')
      except ObjectDoesNotExist:
          pass 

the code does not work.

Error: Reverse for 'cart_detail' not found. 'cart_detail' is not a valid view function or pattern name.

cart/views.py

def cart_detail(request, total=0, counter=0, cart_items = None):
  try:
      cart = Cart.objects.get(cart_id=_cart_id(request))
      cart_items = CartItem.objects.filter(cart=cart, active=True)
      for cart_item in cart_items:
          total += (cart_item.product.price * cart_item.quantity)
          counter += cart_item.quantity
  except ObjectDoesNotExist:
      pass
  try:  
      if request.method == 'POST':
        order_details = Order.objects.create(
              token = token,
              total = total,
              emailAddress = email,
              billingName = billingName,
              billingAddress1 = billingAddress1,
              billingCity = billingcity,
              billingPostcode = billingPostcode,
              billingCountry = billingCountry,
              shippingName = shippingName,
              shippingAddress1 = shippingAddress1,
              shippingCity = shippingcity,
              shippingPostcode = shippingPostcode,
              shippingCountry = shippingCountry
          )
        order_details.save()
        for order_item in cart_items:
                    oi = OrderItem.objects.create(
                          product = order_item.product.name,
                          quantity = order_item.quantity,
                          price = order_item.product.price,
                          order = order_details
                      )
                    oi.save()
                    '''Reduce stock when order is placed or saved'''
                    products = Product.objects.get(id=order_item.product.id)
                    products.stock = int(order_item.product.stock - order_item.quantity)
                    products.save()
                    order_item.delete()
                    '''The terminal will print this message when the order is saved'''
                    print('The order has been created')
        return redirect('cart:cart_detail')
  except ObjectDoesNotExist:
      pass
  return render(request, 'cart/cart.html', dict(cart_items = cart_items, total = total, counter = counter))

templates/shop/cart.html

    <button class="btn send-click btn-md my-1 btn-block" data-toggle="modal" data-target="#inquiryModal">Complete Order</button>

                                <!-- Inquiry Modal -->
<div class="modal fade" id="inquiryModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
    <div class="modal-header">
        <h5 class="modal-title" id="inquiryModalLabel">Complete Order</h5>
        <button type="button" class="close" data-dismiss="modal">
            <span>&times;</span>
        </button>
    </div>
    <div class="modal-body">
            <form action="{% url 'cart_detail' %}" method="POST">
          {% csrf_token %}

            <div class="form-group">
                <label for="emailAddress" class="col-form-label">Email:</label>
                <input type="text" name="emailAddress" class="form-control" 
                value="" required>
            </div>

            <div class="form-group">
                    <label for="billingName" class="col-form-label">Name:</label>
                    <input type="text" name="billingName" class="form-control" 
                    value="" required>
                </div>

                <div class="form-group">
                        <label for="billingAddress1" class="col-form-label">Adress:</label>
                        <input type="text" name="billingAddress1" class="form-control" 
                        value="" required>
                    </div>

                    <div class="form-group">
                            <label for="billingCity" class="col-form-label">City:</label>
                            <input type="text" name="billingCity" class="form-control" 
                            value="" required>
                        </div>

                        <div class="form-group">
                                <label for="billingPostcode" class="col-form-label">Post code:</label>
                                <input type="text" name="billingPostcode" class="form-control" 
                                value="" required>
                        </div>

                        <div class="form-group">
                                <label for="billingCountry" class="col-form-label">Country:</label>
                                <input type="text" name="billingCountry" class="form-control" 
                                value="" required>
                            </div>

                            <div class="form-group">
                                    <label for="shippingName" class="col-form-label">Shop name:</label>
                                    <input type="text" name="shippingName" class="form-control" 
                                    value="" required>
                                </div>

                                <div class="form-group">
                                        <label for="shippingAddress1" class="col-form-label">Shop adress:</label>
                                        <input type="text" name="shippingAddress1" class="form-control" 
                                        value="" required>
                                    </div>

                                    <div class="form-group">
                                            <label for="shippingCity" class="col-form-label">Shop City:</label>
                                            <input type="text" name="shippingCity" class="form-control" 
                                            value="" required>
                                        </div>

                                        <div class="form-group">
                                                <label for="shippingPostcode" class="col-form-label">Shop Post code:</label>
                                                <input type="text" name="shippingPostcode" class="form-control" 
                                                value="" required>
                                            </div>

                                            <div class="form-group">
                                                    <label for="shippingCountry" class="col-form-label">Shop Country:</label>
                                                    <input type="text" name="shippingCountry" class="form-control" 
                                                    value="" required>
                                                </div>
                                            <hr>
                                <input type="submit" value="Order" class="btn send-click btn-md my-0 btn-block">
                        </form>
                    </div>
                </div>

</div>
</div>

orders/models.py

from django.db import models

class Order(models.Model):
    token = models.CharField(max_length=250, blank=True)
    total = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='GBP Order Total')
    emailAddress = models.EmailField(max_length=250, blank=True, verbose_name='Email Address')
    created = models.DateTimeField(auto_now_add=True)
    billingName = models.CharField(max_length=250, blank=True)
    billingAddress1 = models.CharField(max_length=250, blank=True)
    billingCity = models.CharField(max_length=250, blank=True)
    billingPostcode = models.CharField(max_length=10, blank=True)
    billingCountry = models.CharField(max_length=200, blank=True)
    shippingName = models.CharField(max_length=250, blank=True)
    shippingAddress1 = models.CharField(max_length=250, blank=True)
    shippingCity = models.CharField(max_length=250, blank=True)
    shippingPostcode = models.CharField(max_length=10, blank=True)
    shippingCountry = models.CharField(max_length=200, blank=True)

    class Meta:
        db_table = 'Order'
        ordering = ['-created']

    def __str__(self):
        return str(self.id)


class OrderItem(models.Model):
    product = models.CharField(max_length=250)
    quantity = models.IntegerField()
    price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='GBP Price')
    order = models.ForeignKey(Order, on_delete=models.CASCADE)

    class Meta:
        db_table = 'OrderItem'

    def sub_total(self):
        return self.quantity * self.price

    def __str__(self):
        return self.product

cart/urls.py

from django.urls import path
from . import views

app_name='cart'

urlpatterns = [
    path('add/<int:product_id>/', views.add_cart, name='add_cart'),
    path('', views.cart_detail, name='cart_detail'),
    path('remove/<int:product_id>/', views.cart_remove, name='cart_remove'),
    path('full_remove/<int:product_id>/', views.full_remove, name='full_remove'),

]