Add demo orders creation scripts

- Created management command for generating demo orders
- Added SQL script to create 25 orders with random dates (±15 days)
- Added Python runner script for executing SQL
- Demo orders include varied statuses, payment methods, and delivery types
- Orders distributed across different dates for testing date filter

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-07 23:49:06 +03:00
parent fea650a35c
commit e3bab2252e
5 changed files with 414 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
"""
Скрипт для создания демо-заказов напрямую через SQL
"""
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
django.setup()
from django.db import connection
# Читаем SQL скрипт
with open('create_demo_orders.sql', 'r', encoding='utf-8') as f:
sql = f.read()
# Выполняем SQL
with connection.cursor() as cursor:
try:
cursor.execute(sql)
print("[OK] SQL script executed successfully!")
print("[OK] 25 demo orders created!")
except Exception as e:
print(f"[ERROR] {e}")
raise