# Generated by Django 2.2.16 on 2021-02-26 07:57

from django.db import migrations


def init_location(apps, schema_editor):
    User = apps.get_model('users', 'AuthUser')
    Location = apps.get_model('location', 'Location')
    users = User.objects.all()
    for u in users:
        if u.locations.count() == 0:
            loc = Location.objects.create(
                owner=u,
            )
            loc.save()

    return


class Migration(migrations.Migration):

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

    operations = [
        migrations.RunPython(init_location)
    ]
