- Introduced Recipient model to manage order recipients separately from customers. - Updated Order model to link to Recipient, replacing recipient_name and recipient_phone fields. - Enhanced OrderForm to include recipient selection modes: customer, history, and new. - Added AJAX endpoint to fetch recipient history for customers. - Updated admin interface to manage recipients and display recipient information in order details. - Refactored address handling to accommodate new recipient logic. - Improved demo order creation to include random recipients.
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""
|
||
Модели приложения Orders.
|
||
|
||
Структура:
|
||
- OrderStatus: Статусы заказов
|
||
- Address: Адреса доставки
|
||
- Recipient: Получатели заказов
|
||
- Order: Главная модель заказа
|
||
- OrderItem: Позиции в заказе
|
||
- PaymentMethod: Способы оплаты (справочник)
|
||
- Transaction: Финансовые транзакции (платежи и возвраты)
|
||
"""
|
||
|
||
# Порядок импортов по зависимостям:
|
||
# 1. Независимые модели (справочники)
|
||
from .status import OrderStatus
|
||
from .payment_method import PaymentMethod
|
||
|
||
# 2. Модели с зависимостями от справочников
|
||
from .address import Address
|
||
from .recipient import Recipient
|
||
|
||
# 3. Главная модель Order (зависит от Status, Address)
|
||
from .order import Order
|
||
|
||
# 4. Зависимые модели
|
||
from .kit_snapshot import KitSnapshot, KitItemSnapshot
|
||
from .order_item import OrderItem
|
||
from .transaction import Transaction
|
||
|
||
__all__ = [
|
||
'OrderStatus',
|
||
'Address',
|
||
'Recipient',
|
||
'Order',
|
||
'OrderItem',
|
||
'PaymentMethod',
|
||
'Transaction',
|
||
'KitSnapshot',
|
||
'KitItemSnapshot',
|
||
]
|