Analyzing store invoices
If you purchase something in a modern store, it is almost certain that you will receive an invoice. Different stores manage invoices with varying information, but in most cases, you will find the same essential information. Figure 11.1 shows a simple invoice. We will use this as a blueprint to design and implement the Django models that we will use to store the purchase information.
Figure 11.1 – Example of a simple invoice
Let’s analyze the invoice shown in Figure 11.1 to understand the kind of information we need to store for purchase (based on orders and items).
We must store the following information for the order:
- ID: To uniquely identify each order. In the previous figure, it is represented by #1.
- Date: To identify the date on which the order was completed. In the previous figure, it is represented by 2024-04-22.
- Total: To identify the total amount of the order. In the previous figure, it...