# Generated by Django 3.1.7 on 2021-03-23 19:03

from django.db import migrations
# from applications.shop.models import ProductSell


def update_status_to_cancelled(apps, schema_editor):
    product = apps.get_model('shop', 'ProductSell')
    queryset = product.objects.all()
    for product_item in queryset:
        product_item.status = 3
        product_item.save()


def update_status_to_relevant(apps, schema_editor):
    product = apps.get_model('shop', 'ProductSell')
    queryset = product.objects.all()
    for product_item in queryset:
        product_item.status = 1
        product_item.save()


class Migration(migrations.Migration):

    dependencies = [
        ('shop', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(
            code=update_status_to_cancelled, reverse_code=update_status_to_relevant
        )
    ]
