From 9227051e8bdbbae75064da3e537aba499a794289 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 10 Dec 2018 16:55:17 +0100 Subject: Treatments: manage loan, loan return and packaging by parameters --- .../migrations/0049_auto_20181210_1216.py | 53 ------------------ .../migrations/0049_auto_20181210_1518.py | 63 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 53 deletions(-) delete mode 100644 archaeological_finds/migrations/0049_auto_20181210_1216.py create mode 100644 archaeological_finds/migrations/0049_auto_20181210_1518.py (limited to 'archaeological_finds/migrations') diff --git a/archaeological_finds/migrations/0049_auto_20181210_1216.py b/archaeological_finds/migrations/0049_auto_20181210_1216.py deleted file mode 100644 index debe1b775..000000000 --- a/archaeological_finds/migrations/0049_auto_20181210_1216.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.10 on 2018-12-10 12:16 -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="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='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) - ] 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) + ] -- cgit v1.2.3