summaryrefslogtreecommitdiff
path: root/archaeological_finds/migrations/0028_migrate_source_and_image.py
blob: 8f95de8ba14af4b22fd357a79b21c839ef213f08 (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
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-05-30 19:40
from __future__ import unicode_literals

from django.db import migrations

from ishtar_common.utils_migrations import migrate_images, migrate_sources


def migrate_source_and_image(apps, schema_editor):
    Find = apps.get_model(
        'archaeological_finds', 'Find')
    FindImage = apps.get_model(
        'archaeological_finds', 'FindImage')
    FindSource = apps.get_model(
        'archaeological_finds', 'FindSource')
    migrate_images(apps, Find, FindImage)
    migrate_sources(apps, Find, FindSource, 'find')

    Treatment = apps.get_model(
        'archaeological_finds', 'Treatment')
    TreatmentImage = apps.get_model(
        'archaeological_finds', 'TreatmentImage')
    TreatmentSource = apps.get_model(
        'archaeological_finds', 'TreatmentSource')
    migrate_images(apps, Treatment, TreatmentImage)
    migrate_sources(apps, Treatment, TreatmentSource, 'treatment')

    TreatmentFile = apps.get_model(
        'archaeological_finds', 'TreatmentFile')
    TreatmentFileSource = apps.get_model(
        'archaeological_finds', 'TreatmentFileSource')
    migrate_sources(apps, TreatmentFile, TreatmentFileSource, 'treatment_file')


class Migration(migrations.Migration):

    dependencies = [
        ('archaeological_finds', '0027_auto_20180530_1900'),
    ]

    operations = [
        migrations.RunPython(migrate_source_and_image)
    ]