# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-02 11:04
from __future__ import unicode_literals

from django.db import migrations, models
import uuid


def create_uuid(apps, schema_editor):
    UserProfile = apps.get_model('profiles', 'UserProfile')
    for user in UserProfile.objects.all():
        user.uuid = uuid.uuid4()
        user.save()


class Migration(migrations.Migration):

    dependencies = [
        ('profiles', '0018_userprofile_admin_sites'),
    ]

    operations = [
        migrations.AddField(
            model_name='userprofile',
            name='uuid',
            field=models.UUIDField(default=uuid.uuid4, null=True),
        ),
        migrations.RunPython(create_uuid),
        migrations.AlterField(
            model_name='userprofile',
            name='uuid',
            field=models.UUIDField(default=uuid.uuid4, unique=True),
        ),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-02 11:04
from __future__ import unicode_literals

from django.db import migrations, models
import uuid


def create_uuid(apps, schema_editor):
    UserProfile = apps.get_model('profiles', 'UserProfile')
    for user in UserProfile.objects.all():
        user.uuid = uuid.uuid4()
        user.save(update_fields=['uuid'])


class Migration(migrations.Migration):

    dependencies = [
        ('profiles', '0018_userprofile_admin_sites'),
    ]

    operations = [
        migrations.AddField(
            model_name='userprofile',
            name='uuid',
            field=models.UUIDField(default=uuid.uuid4, null=True),
        ),
        migrations.RunPython(create_uuid),
        migrations.AlterField(
            model_name='userprofile',
            name='uuid',
            field=models.UUIDField(default=uuid.uuid4, unique=True),
        ),
    ]

use update_fields