When a shopping cart is checked out, you need to save an order into the database. Orders will contain information about customers and the products they are buying.
Create a new application for managing customer orders using the following command:
python manage.py startapp orders
settings.py file of your project and add
'orders' to the
INSTALLED_APPS setting as follows:
INSTALLED_APPS = ( # ... 'orders', )
You have activated the new application.
You will need a model to store the order details, and a second model to store items bought, including their price and quantity. Edit the
models.py file of the
orders application and add the following code to it:
from django.db import models from shop.models ...