summaryrefslogtreecommitdiff
path: root/archaeological_finds/migrations/0025_migrate_image.py
blob: dccbb444bc02547a8166c15348d2f959cdc7579d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-05-11 12:07
from __future__ import unicode_literals

from django.db import migrations

from ishtar_common.utils_migrations import migrate_simple_image_to_m2m


def migrate_image(apps, schema_editor):
    Find = apps.get_model('archaeological_finds', 'Find')
    IshtarImage = apps.get_model('ishtar_common', 'IshtarImage')
    FindImage = apps.get_model('archaeological_finds',
                               'FindImage')
    migrate_simple_image_to_m2m(Find, IshtarImage, FindImage)

    Treatment = apps.get_model('archaeological_finds', 'Treatment')
    IshtarImage = apps.get_model('ishtar_common', 'IshtarImage')
    TreatmentImage = apps.get_model('archaeological_finds',
                                    'TreatmentImage')
    migrate_simple_image_to_m2m(Treatment, IshtarImage, TreatmentImage)


class Migration(migrations.Migration):

    dependencies = [
        ('archaeological_finds', '0024_auto_20180509_1742'),
    ]

    operations = [
        migrations.RunPython(migrate_image),
    ]