summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-12-10 13:35:25 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-12-10 13:35:25 +0100
commit9cdd630404d25aaedb670de4d52dc3b106a7ef7c (patch)
tree3769b59b9e26efd9298a14bb28b6bfeaf3da6d5c
parent78b28667790ef4d880d2cfe33db471729d1fc245 (diff)
downloadIshtar-9cdd630404d25aaedb670de4d52dc3b106a7ef7c.tar.bz2
Ishtar-9cdd630404d25aaedb670de4d52dc3b106a7ef7c.zip
Treatments: manage loan and loan return by parameters - models
-rw-r--r--archaeological_finds/migrations/0049_auto_20181210_1216.py53
-rw-r--r--archaeological_finds/models_finds.py7
2 files changed, 60 insertions, 0 deletions
diff --git a/archaeological_finds/migrations/0049_auto_20181210_1216.py b/archaeological_finds/migrations/0049_auto_20181210_1216.py
new file mode 100644
index 000000000..debe1b775
--- /dev/null
+++ b/archaeological_finds/migrations/0049_auto_20181210_1216.py
@@ -0,0 +1,53 @@
+# -*- 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/models_finds.py b/archaeological_finds/models_finds.py
index cd827a0d0..318388da1 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -106,6 +106,13 @@ class TreatmentType(HierarchicalType):
help_text=_(
u"Check this if for this treatment from one find you'll get "
u"many."))
+ change_current_location = models.BooleanField(
+ _(u"Change current location"), default=False,
+ help_text=_(u"The treatment change the current location."))
+ restore_reference_location = models.BooleanField(
+ _(u"Restore the reference location"), default=False,
+ help_text=_(u"The treatment change restore reference location to the "
+ u"current location."))
class Meta:
verbose_name = _(u"Treatment type")