# Generated by Django 2.2.20 on 2021-10-01 09:15

from django.db import migrations


def link_flats_to_owners(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    Owner = apps.get_model('property', 'Owner')
    for flat in Flat.objects.all():
        flat.owners.set([Owner.objects.get(
            full_name=flat.owner,
            pure_phone=flat.owner_pure_phone
        )])  


def delete_flat_owner_links(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    for flat in Flat.objects.all():
        flat.owners.clear()


class Migration(migrations.Migration):

    dependencies = [
        ('property', '0015_auto_20211001_1242'),
    ]

    operations = [
        migrations.RunPython(
            link_flats_to_owners,
            delete_flat_owner_links
        )
    ]

76abf4bbd77982ecc53fffed41acb84b8524da7e
<mask token>


class Migration(migrations.Migration):
    <mask token>
    <mask token>

<mask token>


class Migration(migrations.Migration):
    dependencies = [('property', '0015_auto_20211001_1242')]
    operations = [migrations.RunPython(link_flats_to_owners,
        delete_flat_owner_links)]

<mask token>


def link_flats_to_owners(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    Owner = apps.get_model('property', 'Owner')
    for flat in Flat.objects.all():
        flat.owners.set([Owner.objects.get(full_name=flat.owner, pure_phone
            =flat.owner_pure_phone)])


def delete_flat_owner_links(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    for flat in Flat.objects.all():
        flat.owners.clear()


class Migration(migrations.Migration):
    dependencies = [('property', '0015_auto_20211001_1242')]
    operations = [migrations.RunPython(link_flats_to_owners,
        delete_flat_owner_links)]

from django.db import migrations


def link_flats_to_owners(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    Owner = apps.get_model('property', 'Owner')
    for flat in Flat.objects.all():
        flat.owners.set([Owner.objects.get(full_name=flat.owner, pure_phone
            =flat.owner_pure_phone)])


def delete_flat_owner_links(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    for flat in Flat.objects.all():
        flat.owners.clear()


class Migration(migrations.Migration):
    dependencies = [('property', '0015_auto_20211001_1242')]
    operations = [migrations.RunPython(link_flats_to_owners,
        delete_flat_owner_links)]

# Generated by Django 2.2.20 on 2021-10-01 09:15

from django.db import migrations


def link_flats_to_owners(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    Owner = apps.get_model('property', 'Owner')
    for flat in Flat.objects.all():
        flat.owners.set([Owner.objects.get(
            full_name=flat.owner,
            pure_phone=flat.owner_pure_phone
        )])  


def delete_flat_owner_links(apps, schema_editor):
    Flat = apps.get_model('property', 'Flat')
    for flat in Flat.objects.all():
        flat.owners.clear()


class Migration(migrations.Migration):

    dependencies = [
        ('property', '0015_auto_20211001_1242'),
    ]

    operations = [
        migrations.RunPython(
            link_flats_to_owners,
            delete_flat_owner_links
        )
    ]
