# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-26 03:37
from __future__ import unicode_literals

from django.db import migrations, models


def forwards_func(apps, schema_editor):
    Sender = apps.get_model('promgen', 'Sender')
    for sender in Sender.objects.all():
        if sender.password:
            sender.alias = '***'
            sender.save()


def reverse_func(apps, schema_editor):
    Sender = apps.get_model('promgen', 'Sender')
    for sender in Sender.objects.all():
        if sender.alias:
            sender.password = True
            sender.save()


class Migration(migrations.Migration):
    dependencies = [
        ('promgen', '0019_url'),
    ]

    operations = [
        migrations.AddField(
            model_name='sender',
            name='alias',
            field=models.CharField(blank=True, max_length=128),
        ),
        migrations.RunPython(forwards_func, reverse_func, elidable=True),
        migrations.RemoveField(
            model_name='sender',
            name='password',
        ),
    ]
