# Generated by Django 2.0.4 on 2018-04-09 21:55

from django.db import migrations
from django.db.models import F


def forwards(apps, schema_editor):
    Book = apps.get_model("books", "Book")
    db_alias = schema_editor.connection.alias
    m = Book.objects.using(db_alias)
    m.filter(start_page=None).update(start_page=1)
    m.filter(end_page=None).update(end_page=F('num_pages'))


class Migration(migrations.Migration):
    dependencies = [
        ('books', '0005_auto_20180409_2147'),
    ]

    operations = [
        migrations.RunPython(forwards)
    ]
