# Generated by Django 2.1.2 on 2018-10-10 08:55

from django.db import migrations, models


def update_mime_type(apps, schema_editor):
    # set mime_type from file
    from pyazo.utils.files import get_mime_type

    Upload = apps.get_model("pyazo_core", "Upload")
    for upload in Upload.objects.all():
        upload.mime_type = get_mime_type(upload.file.name)
        upload.save()


class Migration(migrations.Migration):

    dependencies = [
        ("pyazo_core", "0006_auto_20181009_1450"),
    ]

    operations = [
        migrations.AddField(
            model_name="upload",
            name="mime_type",
            field=models.TextField(default=""),
            preserve_default=False,
        ),
        migrations.RunPython(update_mime_type),
    ]

# Generated by Django 2.1.2 on 2018-10-10 08:55

from django.db import migrations, models


def update_mime_type(apps, schema_editor):
    # set mime_type from file
    from pyazo.utils.files import get_mime_type

    Upload = apps.get_model("pyazo_core", "Upload")
    for upload in Upload.objects.all():
        upload.mime_type = get_mime_type(upload.file.name)
        upload.save()


class Migration(migrations.Migration):

    dependencies = [
        ("pyazo_core", "0006_auto_20181009_1450"),
    ]

    operations = [
        migrations.AddField(
            model_name="upload",
            name="mime_type",
            field=models.TextField(default=""),
            preserve_default=False,
        ),
        migrations.RunPython(update_mime_type),
    ]

# Generated by Django 2.1.2 on 2018-10-10 08:55 # set mime_type from file