# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-24 08:35
from __future__ import unicode_literals

from django.db import migrations, models


def migrate_comm_log_document(apps, schema_editor):
    model = apps.get_model('wl_main', 'CommunicationsLogEntry')
    for entry in model.objects.all():
        if bool(entry.document):
            entry.documents.add(entry.document)


class Migration(migrations.Migration):
    dependencies = [
        ('accounts', '0001_initial'),
        ('wl_main', '0012_auto_20160824_1614'),
    ]

    operations = [
        migrations.AddField(
            model_name='communicationslogentry',
            name='documents',
            field=models.ManyToManyField(blank=True, to='accounts.Document'),
        ),
        migrations.RunPython(migrate_comm_log_document),
        migrations.RemoveField(
            model_name='communicationslogentry',
            name='document',
        ),
    ]
