25 lines
570 B
Python
25 lines
570 B
Python
# 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),
|
||
]
|