# Generated by Django 2.2.4 on 2019-09-23 11:34

from django.db import migrations
from django.conf import settings


def copy_image_links(apps, schemaeditor):
    News = apps.get_model('news', 'News')
    for news in News.objects.all():
        if news.image:
            news.image_url = f'{settings.SCHEMA_URI}://{settings.DOMAIN_URI}{news.image.image.url}'
            news.save()


class Migration(migrations.Migration):

    dependencies = [
        ('news', '0010_auto_20190923_1131'),
    ]

    operations = [
        migrations.RunPython(copy_image_links, migrations.RunPython.noop),

        migrations.RemoveField(
            model_name='news',
            name='image',
        ),
    ]
