summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_context_records/migrations/0103_historicalcontextrecord_history_change_reason.py118
-rw-r--r--archaeological_files/migrations/0102_historicalfile_history_change_reason.py141
-rw-r--r--archaeological_finds/migrations/0103_auto_20200129_1944.py355
-rw-r--r--archaeological_operations/migrations/0103_auto_20200129_1941.py291
-rw-r--r--ishtar_common/migrations/0202_auto_20200129_1941.py99
-rw-r--r--ishtar_common/models.py50
-rw-r--r--requirements.txt2
7 files changed, 1049 insertions, 7 deletions
diff --git a/archaeological_context_records/migrations/0103_historicalcontextrecord_history_change_reason.py b/archaeological_context_records/migrations/0103_historicalcontextrecord_history_change_reason.py
index 9d2f8ab29..85a7de0fb 100644
--- a/archaeological_context_records/migrations/0103_historicalcontextrecord_history_change_reason.py
+++ b/archaeological_context_records/migrations/0103_historicalcontextrecord_history_change_reason.py
@@ -3,6 +3,8 @@
from __future__ import unicode_literals
from django.db import migrations, models
+import django.db.models.deletion
+from django.conf import settings
class Migration(migrations.Migration):
@@ -17,4 +19,120 @@ class Migration(migrations.Migration):
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='activity',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_context_records.ActivityType',
+ verbose_name='Activity'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='archaeological_site',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.ArchaeologicalSite',
+ verbose_name='Archaeological site'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='excavation_technic',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_context_records.ExcavationTechnicType',
+ verbose_name='Excavation technique'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='identification',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_context_records.IdentificationType',
+ verbose_name='Identification'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Document',
+ verbose_name='Main image'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='operation',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.Operation',
+ verbose_name='Operation'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='parcel',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.Parcel',
+ verbose_name='Parcel'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='spatial_reference_system',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.SpatialReferenceSystem',
+ verbose_name='Spatial Reference System'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='town',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Town',
+ verbose_name='Town'),
+ ),
+ migrations.AlterField(
+ model_name='historicalcontextrecord',
+ name='unit',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_context_records.Unit',
+ verbose_name='Context record type'),
+ ),
]
diff --git a/archaeological_files/migrations/0102_historicalfile_history_change_reason.py b/archaeological_files/migrations/0102_historicalfile_history_change_reason.py
index 691d25350..a05ee7bc9 100644
--- a/archaeological_files/migrations/0102_historicalfile_history_change_reason.py
+++ b/archaeological_files/migrations/0102_historicalfile_history_change_reason.py
@@ -3,6 +3,8 @@
from __future__ import unicode_literals
from django.db import migrations, models
+import django.db.models.deletion
+from django.conf import settings
class Migration(migrations.Migration):
@@ -17,4 +19,143 @@ class Migration(migrations.Migration):
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='corporation_general_contractor',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='General contractor organization'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='file_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_files.FileType',
+ verbose_name='File type'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='general_contractor',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='General contractor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='in_charge',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Person in charge'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='main_town',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Town',
+ verbose_name='Main town'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='organization',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Organization'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='permit_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_files.PermitType',
+ verbose_name='Permit type'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='planning_service',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Planning service organization'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='related_file',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_files.File',
+ verbose_name='Related file'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='requested_operation_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.OperationType',
+ verbose_name='Requested operation type'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='responsible_town_planning_service',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Responsible for planning service'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='saisine_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_files.SaisineType',
+ verbose_name='Type de saisine'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfile',
+ name='scientist',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Scientist in charge'),
+ ),
]
diff --git a/archaeological_finds/migrations/0103_auto_20200129_1944.py b/archaeological_finds/migrations/0103_auto_20200129_1944.py
index 533094bde..48bfed176 100644
--- a/archaeological_finds/migrations/0103_auto_20200129_1944.py
+++ b/archaeological_finds/migrations/0103_auto_20200129_1944.py
@@ -3,6 +3,10 @@
from __future__ import unicode_literals
from django.db import migrations, models
+import django.db.models.deletion
+from django.conf import settings
+
+import archaeological_finds.models_treatments
class Migration(migrations.Migration):
@@ -32,4 +36,355 @@ class Migration(migrations.Migration):
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='batch',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.BatchType',
+ verbose_name='Batch/object'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='context_record',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_context_records.ContextRecord',
+ verbose_name='Context Record'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='spatial_reference_system',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.SpatialReferenceSystem',
+ verbose_name='Spatial Reference System'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='checked_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.CheckedType',
+ verbose_name='Check'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='collection',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_warehouse.Collection',
+ verbose_name='Collection'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='conservatory_state',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.ConservatoryState',
+ verbose_name='Conservatory state'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='container',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_warehouse.Container',
+ verbose_name='Container'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='container_ref',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_warehouse.Container',
+ verbose_name='Reference container'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='downstream_treatment',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.Treatment',
+ verbose_name='Downstream treatment'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Document',
+ verbose_name='Main image'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='material_type_quality',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.MaterialTypeQualityType',
+ verbose_name='Material type quality'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='object_type_quality',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.ObjectTypeQualityType',
+ verbose_name='Object type quality'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='treatment_emergency',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.TreatmentEmergencyType',
+ verbose_name='Treatment emergency'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='upstream_treatment',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.Treatment',
+ verbose_name='Upstream treatment'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='container',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_warehouse.Container',
+ verbose_name='Container'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='file',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.TreatmentFile',
+ verbose_name='Associated request'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='location',
+ field=models.ForeignKey(blank=True, db_constraint=False,
+ help_text='Location where the treatment is done. Target warehouse for a move.',
+ null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_warehouse.Warehouse',
+ verbose_name='Location'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Document',
+ verbose_name='Main image'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='organization',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Organization'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='person',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Responsible'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='scientific_monitoring_manager',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Scientific monitoring manager'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='treatment_state',
+ field=models.ForeignKey(blank=True, db_constraint=False,
+ default=archaeological_finds.models_treatments.TreatmentState.get_default,
+ null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.TreatmentState',
+ verbose_name='State'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='applicant',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Applicant'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='applicant_organisation',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Applicant organisation'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='in_charge',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Person in charge'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Document',
+ verbose_name='Main image'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatmentfile',
+ name='type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.TreatmentFileType',
+ verbose_name='Treatment request type'),
+ ),
]
diff --git a/archaeological_operations/migrations/0103_auto_20200129_1941.py b/archaeological_operations/migrations/0103_auto_20200129_1941.py
index 2a30a7a7b..e737c4356 100644
--- a/archaeological_operations/migrations/0103_auto_20200129_1941.py
+++ b/archaeological_operations/migrations/0103_auto_20200129_1941.py
@@ -3,6 +3,8 @@
from __future__ import unicode_literals
from django.db import migrations, models
+import django.db.models.deletion
+from django.conf import settings
class Migration(migrations.Migration):
@@ -27,4 +29,293 @@ class Migration(migrations.Migration):
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='act_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.ActType',
+ verbose_name='Act type'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='associated_file',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_files.File',
+ verbose_name='Archaeological file'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='in_charge',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Person in charge of the operation'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='operation',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.Operation',
+ verbose_name='Operation'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='operator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Archaeological preventive operator'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='scientist',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Scientist in charge'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='signatory',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Signatory'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='treatment',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.Treatment',
+ verbose_name='Treatment'),
+ ),
+ migrations.AlterField(
+ model_name='historicaladministrativeact',
+ name='treatment_file',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_finds.TreatmentFile',
+ verbose_name='Treatment request'),
+ ),
+ migrations.AlterField(
+ model_name='historicalarchaeologicalsite',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalarchaeologicalsite',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalarchaeologicalsite',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalarchaeologicalsite',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Document',
+ verbose_name='Main image'),
+ ),
+ migrations.AlterField(
+ model_name='historicalarchaeologicalsite',
+ name='spatial_reference_system',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.SpatialReferenceSystem',
+ verbose_name='Spatial Reference System'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='applicant_authority',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Applicant authority'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='associated_file',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_files.File',
+ verbose_name='File'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='cira_rapporteur',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Rapporteur CIRA'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='in_charge',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='In charge'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Document',
+ verbose_name='Main image'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='minutes_writer',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Writer of the minutes'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='operation_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.OperationType',
+ verbose_name='Operation type'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='operator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Operator'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='protagonist',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='Name of the protagonist'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='record_quality_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.RecordQualityType',
+ verbose_name='Record quality'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='report_processing',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='archaeological_operations.ReportState',
+ verbose_name='Report processing'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='scientist',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Person',
+ verbose_name='In charge scientist'),
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='spatial_reference_system',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.SpatialReferenceSystem',
+ verbose_name='Spatial Reference System'),
+ ),
]
diff --git a/ishtar_common/migrations/0202_auto_20200129_1941.py b/ishtar_common/migrations/0202_auto_20200129_1941.py
index 0e640188a..02f13f170 100644
--- a/ishtar_common/migrations/0202_auto_20200129_1941.py
+++ b/ishtar_common/migrations/0202_auto_20200129_1941.py
@@ -3,6 +3,8 @@
from __future__ import unicode_literals
from django.db import migrations, models
+import django.db.models.deletion
+from django.conf import settings
class Migration(migrations.Migration):
@@ -22,4 +24,101 @@ class Migration(migrations.Migration):
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
+ migrations.AlterField(
+ model_name='historicalorganization',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalorganization',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalorganization',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalorganization',
+ name='organization_type',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.OrganizationType',
+ verbose_name='Type'),
+ ),
+ migrations.AlterField(
+ model_name='historicalorganization',
+ name='precise_town',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Town',
+ verbose_name='Town (precise)'),
+ ),
+ migrations.AlterField(
+ model_name='historicalperson',
+ name='attached_to',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.Organization',
+ verbose_name='Is attached to'),
+ ),
+ migrations.AlterField(
+ model_name='historicalperson',
+ name='history_creator',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Creator'),
+ ),
+ migrations.AlterField(
+ model_name='historicalperson',
+ name='history_modifier',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Last editor'),
+ ),
+ migrations.AlterField(
+ model_name='historicalperson',
+ name='lock_user',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to=settings.AUTH_USER_MODEL,
+ verbose_name='Locked by'),
+ ),
+ migrations.AlterField(
+ model_name='historicalperson',
+ name='precise_town',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+', to='ishtar_common.Town',
+ verbose_name='Town (precise)'),
+ ),
+ migrations.AlterField(
+ model_name='historicalperson',
+ name='title',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True,
+ on_delete=django.db.models.deletion.DO_NOTHING,
+ related_name='+',
+ to='ishtar_common.TitleType',
+ verbose_name='Title'),
+ ),
]
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index d0612d648..3900611b6 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -74,6 +74,8 @@ from ishtar_common.utils import ugettext_lazy as _, ugettext, \
pgettext_lazy
from ishtar_common.utils_secretary import IshtarSecretaryRenderer
from simple_history.models import HistoricalRecords as BaseHistoricalRecords
+from simple_history.signals import post_create_historical_record, \
+ pre_create_historical_record
from unidecode import unidecode
from ishtar_common.alternative_configs import ALTERNATE_CONFIGS, \
@@ -233,13 +235,48 @@ class HistoryModel(models.Model):
class HistoricalRecords(BaseHistoricalRecords):
- def create_historical_record(self, instance, type):
+ def _save_historic(self, manager, instance, history_date, history_type,
+ history_user, history_change_reason, using, attrs):
+ history_instance = manager.model(
+ history_date=history_date,
+ history_type=history_type,
+ history_user=history_user,
+ history_change_reason=history_change_reason,
+ **attrs
+ )
+
+ pre_create_historical_record.send(
+ sender=manager.model,
+ instance=instance,
+ history_date=history_date,
+ history_user=history_user,
+ history_change_reason=history_change_reason,
+ history_instance=history_instance,
+ using=using,
+ )
+
+ history_instance.save(using=using)
+
+ post_create_historical_record.send(
+ sender=manager.model,
+ instance=instance,
+ history_instance=history_instance,
+ history_date=history_date,
+ history_user=history_user,
+ history_change_reason=history_change_reason,
+ using=using,
+ )
+
+ def create_historical_record(self, instance, history_type, using=None):
try:
history_modifier = getattr(instance, 'history_modifier', None)
assert history_modifier
except (User.DoesNotExist, AssertionError):
# on batch removing of users, user could have disappeared
return
+ history_date = getattr(instance, "_history_date",
+ datetime.datetime.now())
+ history_change_reason = getattr(instance, "changeReason", None)
force = getattr(instance, "_force_history", False)
manager = getattr(instance, self.manager_name)
attrs = {}
@@ -252,8 +289,9 @@ class HistoricalRecords(BaseHistoricalRecords):
if not q_history.count():
if force:
delattr(instance, '_force_history')
- manager.create(history_type=type,
- history_date=datetime.datetime.now(), **attrs)
+ self._save_historic(
+ manager, instance, history_date, history_type, history_modifier,
+ history_change_reason, using, attrs)
return
old_instance = q_history.all()[0]
# multiple saving by the same user in a very short time are generaly
@@ -269,12 +307,12 @@ class HistoricalRecords(BaseHistoricalRecords):
if force:
delattr(instance, '_force_history')
- if 'history_date' not in attrs or not attrs['history_date']:
- attrs['history_date'] = datetime.datetime.now()
# record a new version only if data have been changed
for field in instance._meta.fields:
if getattr(old_instance, field.attname) != attrs[field.attname]:
- manager.create(history_type=type, **attrs)
+ self._save_historic(manager, instance, history_date,
+ history_type, history_modifier,
+ history_change_reason, using, attrs)
return
diff --git a/requirements.txt b/requirements.txt
index e8cd118ca..680b2986a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -30,6 +30,6 @@ django-formtools==2.0
secretary==0.2.19
unidecode
--e git+https://github.com/treyhunner/django-simple-history.git@1.9.1#egg=django-simple-history
+-e git+https://github.com/treyhunner/django-simple-history.git@2.7.0#egg=django-simple-history
django-extensions==2.1.4