diff options
Diffstat (limited to 'archaeological_finds/migrations/0040_auto_20181120_1027.py')
-rw-r--r-- | archaeological_finds/migrations/0040_auto_20181120_1027.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/archaeological_finds/migrations/0040_auto_20181120_1027.py b/archaeological_finds/migrations/0040_auto_20181120_1027.py new file mode 100644 index 000000000..fd649dd8f --- /dev/null +++ b/archaeological_finds/migrations/0040_auto_20181120_1027.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.10 on 2018-11-20 10:27 +from __future__ import unicode_literals + +from django.db import migrations, models + + +def init_create_new_find(apps, schema): + TreatmentType = apps.get_model('archaeological_finds', 'TreatmentType') + for tp in TreatmentType.objects.all(): + if (tp.upstream_is_many or tp.downstream_is_many) and not tp.virtual: + tp.create_new_find = True + tp.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_finds', '0039_auto_20181115_1649'), + ] + + operations = [ + migrations.AlterModelOptions( + name='treatment', + options={'ordering': ('start_date',), 'permissions': (('view_treatment', 'Can view all Treatments'), ('view_own_treatment', 'Can view own Treatment'), ('add_own_treatment', 'Can add own Treatment'), ('change_own_treatment', 'Can change own Treatment'), ('delete_own_treatment', 'Can delete own Treatment')), 'verbose_name': 'Treatment', 'verbose_name_plural': 'Treatments'}, + ), + migrations.AddField( + model_name='treatmenttype', + name='create_new_find', + field=models.BooleanField(default=False, help_text='If True when this treatment is applied a new version of the object will be created.', verbose_name='Create a new find'), + ), + migrations.RunPython(init_create_new_find) + ] |