diff options
Diffstat (limited to 'ishtar_common/migrations/0094_auto_20190429_0950.py')
| -rw-r--r-- | ishtar_common/migrations/0094_auto_20190429_0950.py | 53 | 
1 files changed, 0 insertions, 53 deletions
| diff --git a/ishtar_common/migrations/0094_auto_20190429_0950.py b/ishtar_common/migrations/0094_auto_20190429_0950.py deleted file mode 100644 index 4d82e2034..000000000 --- a/ishtar_common/migrations/0094_auto_20190429_0950.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.18 on 2019-04-29 09:50 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion -from django.utils.text import slugify - - -CLASS_NAMES = { -    'archaeological_operations.models.AdministrativeAct': "Acte administratif" -} - - -def migrate_to_model_fk(apps, schema_editor): -    ImporterModel = apps.get_model('ishtar_common', 'ImporterModel') -    DocumentTemplate = apps.get_model('ishtar_common', 'DocumentTemplate') -    importer_models = {} -    for doc in DocumentTemplate.objects.all(): -        if doc.associated_object_name not in importer_models: -            if doc.associated_object_name in CLASS_NAMES: -                name = CLASS_NAMES[doc.associated_object_name] -            else: -                name = "-" -            importer_models[doc.associated_object_name], __ = \ -                ImporterModel.objects.get_or_create( -                    klass=doc.associated_object_name, -                    defaults={"name": name} -                ) -        if not doc.slug: -            doc.slug = slugify(doc.name) -        doc.associated_model = importer_models[doc.associated_object_name] -        doc.save() - - -class Migration(migrations.Migration): - -    dependencies = [ -        ('ishtar_common', '0093_ishtarsiteprofile_display_srs'), -    ] - -    operations = [ -        migrations.AlterModelOptions( -            name='importermodel', -            options={'ordering': ('name',), 'verbose_name': 'Model', 'verbose_name_plural': 'Models'}, -        ), -        migrations.AddField( -            model_name='documenttemplate', -            name='associated_model', -            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.ImporterModel'), -        ), -        migrations.RunPython(migrate_to_model_fk), -    ] | 
