Feature: справочник Статусы заказов, поле Статус в заказе клиента, оформление в списке (зелёный/песочный)
Made-with: Cursor
This commit is contained in:
24
app/references/migrations/0003_orderstatus_data.py
Normal file
24
app/references/migrations/0003_orderstatus_data.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Data migration: начальные статусы заказов
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create_default_statuses(apps, schema_editor):
|
||||
OrderStatus = apps.get_model("references", "OrderStatus")
|
||||
for name in ["В работе", "Выполнено"]:
|
||||
OrderStatus.objects.get_or_create(name=name)
|
||||
|
||||
|
||||
def noop(apps, schema_editor):
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("references", "0002_order_status"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_default_statuses, noop),
|
||||
]
|
||||
Reference in New Issue
Block a user