# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-21 07:49
from __future__ import unicode_literals

from django.db import migrations


LOOKUP_DATA = {
    'Author 1': 'http://example.com',
    'Author 2': 'http://other.org',
}


def forwards(apps, schema_editor):
    Author = apps.get_model('non_nullable_field', 'Author')
    for author in Author.objects.filter(homepage__isnull=True):
        author.homepage = LOOKUP_DATA[author.name]
        author.save(update_fields=['homepage'])


class Migration(migrations.Migration):

    dependencies = [
        ('non_nullable_field', '0003_author_homepage'),
    ]

    operations = [
        migrations.RunPython(forwards, migrations.RunPython.noop),
    ]
