diff options
Diffstat (limited to 'archaeological_finds/migrations/0049_auto_20181210_1518.py')
-rw-r--r-- | archaeological_finds/migrations/0049_auto_20181210_1518.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/archaeological_finds/migrations/0049_auto_20181210_1518.py b/archaeological_finds/migrations/0049_auto_20181210_1518.py new file mode 100644 index 000000000..d2510c7fd --- /dev/null +++ b/archaeological_finds/migrations/0049_auto_20181210_1518.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.10 on 2018-12-10 15:18 +from __future__ import unicode_literals + +from django.db import migrations, models + + +def migrate_treatment_types(apps, schema): + TreatmentType = apps.get_model('archaeological_finds', 'TreatmentType') + q = TreatmentType.objects.filter(txt_idx="loan") + if q.count(): + loan = q.all()[0] + loan.change_current_location = True + loan.save() + q = TreatmentType.objects.filter(txt_idx="loan-return") + if q.count(): + loan_r = q.all()[0] + loan_r.restore_reference_location = True + loan_r.save() + q = TreatmentType.objects.filter(txt_idx="packaging") + if q.count(): + packaging = q.all()[0] + packaging.change_reference_location = True + packaging.save() + q = TreatmentType.objects.filter(txt_idx="virtual-reassembly") + if q.count(): + v = q.all()[0] + v.upstream_is_many = False + v.save() + q = TreatmentType.objects.filter(txt_idx="virtual_group") + if q.count(): + v = q.all()[0] + v.upstream_is_many = False + v.save() + for t in TreatmentType.objects.all(): + t.txt_idx = t.txt_idx.replace("_", "-") + t.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_finds', '0048_auto_20181203_1746'), + ] + + operations = [ + migrations.AddField( + model_name='treatmenttype', + name='change_current_location', + field=models.BooleanField(default=False, help_text='The treatment change the current location.', verbose_name='Change current location'), + ), + migrations.AddField( + model_name='treatmenttype', + name='change_reference_location', + field=models.BooleanField(default=False, help_text='The treatment change the reference location.', verbose_name='Change reference location'), + ), + migrations.AddField( + model_name='treatmenttype', + name='restore_reference_location', + field=models.BooleanField(default=False, help_text='The treatment change restore reference location to the current location.', verbose_name='Restore the reference location'), + ), + migrations.RunPython(migrate_treatment_types) + ] |