22 lines
567 B
Python
22 lines
567 B
Python
# Generated by Django 3.2.5 on 2021-07-26 19:38
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def populate_opr(apps, schema_editor):
|
|
OrderProductRelation = apps.get_model("shop", "OrderProductRelation")
|
|
ShopTicket = apps.get_model("tickets", "ShopTicket")
|
|
|
|
for st in ShopTicket.objects.all():
|
|
st.opr = OrderProductRelation.objects.get(product=st.product, order=st.order)
|
|
st.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("tickets", "0015_shopticket_opr"),
|
|
]
|
|
|
|
operations = [migrations.RunPython(populate_opr)]
|