Answer the question
In order to leave comments, you need to log in
Product, Cart, Customer, Delivery, Payment, Order - what are the relationships between models in the Django project (online store)?
I made such relationships in models:
Product - many to many (Cart)
Customer - one to many (Order)
Delivery - one to one (Order)
Cart - one to one (Order)
Payment - one to one (Order)
1) What did it right, what's wrong?
2) What are the typical connections between these models?
Answer the question
In order to leave comments, you need to log in
Invent a virtual store for yourself Invent
the rules for how it works
Implement
Then change everything
There is no right or wrong option - the business sets the rules, not the developer
The easiest way is to take a ready-made Django store module as an example and see how everything is arranged inside. There are tons of django stores for you to choose from.
As for your data schema, I would correct it like this:
Товар - не связан с корзиной.
ЭлементКорзины - имеет внешние ключи к Товар и Заказ.
Заказ - содержит поля АдресДоставки (заполнятся клиентом) и ДоставкаВыполнена (булево поле или дата).
Корзина (как таблица БД) - не нужна.
Доставка (как таблица БД) - не нужна.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question