diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-05-30 20:26:21 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 09:57:24 +0200 | 
| commit | 66a376e081e335cf94ecf6fd41e5fe13a5445c57 (patch) | |
| tree | 981ddce21bc6bad956c5b012baf9608fdfe909b1 /archaeological_finds/migrations/0028_migrate_source_and_image.py | |
| parent | 3f3c588de0995c1aec212772059f921c165abfac (diff) | |
| download | Ishtar-66a376e081e335cf94ecf6fd41e5fe13a5445c57.tar.bz2 Ishtar-66a376e081e335cf94ecf6fd41e5fe13a5445c57.zip | |
Migrate images and sources to new document model (refs #4107)
Diffstat (limited to 'archaeological_finds/migrations/0028_migrate_source_and_image.py')
| -rw-r--r-- | archaeological_finds/migrations/0028_migrate_source_and_image.py | 44 | 
1 files changed, 44 insertions, 0 deletions
| diff --git a/archaeological_finds/migrations/0028_migrate_source_and_image.py b/archaeological_finds/migrations/0028_migrate_source_and_image.py new file mode 100644 index 000000000..8f95de8ba --- /dev/null +++ b/archaeological_finds/migrations/0028_migrate_source_and_image.py @@ -0,0 +1,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) +    ] | 
