- 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>
25 lines
634 B
Python
25 lines
634 B
Python
"""
|
|
Скрипт для создания демо-заказов напрямую через 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
|