# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-04 13:34


from django.db import migrations


def migrate_privacy_email(apps, schema_editor):
    UserProfile = apps.get_model('users', 'UserProfile')
    IdpProfile = apps.get_model('users', 'IdpProfile')

    for idp in IdpProfile.objects.filter(primary_contact_identity=True):
        UserProfile.objects.filter(pk=idp.profile.pk).update(privacy_email=idp.privacy)


def backwards(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('users', '0035_auto_20180604_0439'),
    ]

    operations = [
        migrations.RunPython(migrate_privacy_email, backwards),
    ]
