Удалена устаревшая логика адресов клиентов

Исправлена ошибка AttributeError при создании нового клиента.
Адреса теперь привязаны к заказам, а не к клиентам.

- Удалено обращение к customer.addresses в customer_detail view
- Убрана секция "Адреса доставки" из шаблона customer_detail.html
- Исправлена команда create_demo_orders для работы с новой структурой

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-11 17:04:20 +03:00
parent 8cc8cd1339
commit 0973121b39
3 changed files with 4 additions and 43 deletions

View File

@@ -108,12 +108,8 @@ class Command(BaseCommand):
# Устанавливаем адрес или магазин
if is_delivery and addresses:
# Для доставки выбираем адрес клиента или случайный
customer_addresses = list(customer.addresses.all())
if customer_addresses:
order.delivery_address = random.choice(customer_addresses)
else:
order.delivery_address = random.choice(addresses)
# Для доставки выбираем случайный адрес (адреса теперь привязаны к заказам)
order.delivery_address = random.choice(addresses)
order.delivery_cost = Decimal(random.randint(200, 500))
elif shops:
order.pickup_shop = random.choice(shops)