summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-02-19 17:36:25 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-04-24 19:38:56 +0200
commit4f63ed814f96bbc68c22c98b799c3911d62aa737 (patch)
tree1ac2de99841b7a28fee128a68700f59458594f14 /archaeological_finds
parentb6d3f2dc4a24bb055b73b7c80815685572a83086 (diff)
downloadIshtar-4f63ed814f96bbc68c22c98b799c3911d62aa737.tar.bz2
Ishtar-4f63ed814f96bbc68c22c98b799c3911d62aa737.zip
Geo: manage container and warehouse - manage geo save dependencies
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/migrations/0064_auto_20190218_1808.py182
-rw-r--r--archaeological_finds/models_finds.py36
2 files changed, 191 insertions, 27 deletions
diff --git a/archaeological_finds/migrations/0064_auto_20190218_1808.py b/archaeological_finds/migrations/0064_auto_20190218_1808.py
new file mode 100644
index 000000000..2b13c0eee
--- /dev/null
+++ b/archaeological_finds/migrations/0064_auto_20190218_1808.py
@@ -0,0 +1,182 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2019-02-18 18:08
+from __future__ import unicode_literals
+
+import django.contrib.gis.db.models.fields
+from django.db import migrations, models
+import django.db.models.deletion
+import ishtar_common.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_finds', '0063_auto_20190206_1423'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='conservatorystate',
+ options={'ordering': ('order', 'label'), 'verbose_name': "Type d'\xe9tat de conservation", 'verbose_name_plural': "Types d'\xe9tat de conservation"},
+ ),
+ migrations.AddField(
+ model_name='basefind',
+ name='multi_polygon_source_item',
+ field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Multi polygon source item'),
+ ),
+ migrations.AddField(
+ model_name='basefind',
+ name='point_source_item',
+ field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Point source item'),
+ ),
+ migrations.AddField(
+ model_name='historicalbasefind',
+ name='multi_polygon_source_item',
+ field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Multi polygon source item'),
+ ),
+ migrations.AddField(
+ model_name='historicalbasefind',
+ name='point_source_item',
+ field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Point source item'),
+ ),
+ migrations.AlterField(
+ model_name='basefind',
+ name='point',
+ field=django.contrib.gis.db.models.fields.PointField(blank=True, dim=3, null=True, srid=4326, verbose_name='Point'),
+ ),
+ migrations.AlterField(
+ model_name='basefind',
+ name='spatial_reference_system',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.SpatialReferenceSystem', verbose_name='Syst\xe8me de r\xe9f\xe9rence spatiale'),
+ ),
+ migrations.AlterField(
+ model_name='basefind',
+ name='x',
+ field=models.FloatField(blank=True, null=True, verbose_name='X/Long'),
+ ),
+ migrations.AlterField(
+ model_name='basefind',
+ name='y',
+ field=models.FloatField(blank=True, null=True, verbose_name='Y/Lat'),
+ ),
+ migrations.AlterField(
+ model_name='find',
+ name='circumference',
+ field=models.FloatField(blank=True, null=True, verbose_name='Circonf\xe9rence (cm)'),
+ ),
+ migrations.AlterField(
+ model_name='find',
+ name='container_ref',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='finds_ref', to='archaeological_warehouse.Container', verbose_name='Contenant de r\xe9f\xe9rence'),
+ ),
+ migrations.AlterField(
+ model_name='find',
+ name='main_image',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='main_image_finds', to='ishtar_common.Document', verbose_name='Image principale'),
+ ),
+ migrations.AlterField(
+ model_name='find',
+ name='treatments',
+ field=models.ManyToManyField(blank=True, help_text="Traitements associ\xe9s quand il n'y a pas de cr\xe9ation de nouveau mobilier", related_name='finds', to='archaeological_finds.Treatment', verbose_name='Traitements'),
+ ),
+ migrations.AlterField(
+ model_name='findbasket',
+ name='shared_with',
+ field=models.ManyToManyField(blank=True, related_name='shared_findbaskets', to='ishtar_common.IshtarUser', verbose_name='Partag\xe9 (lecture) avec'),
+ ),
+ migrations.AlterField(
+ model_name='findbasket',
+ name='shared_write_with',
+ field=models.ManyToManyField(blank=True, related_name='shared_write_findbaskets', to='ishtar_common.IshtarUser', verbose_name='Partag\xe9 (lecture/\xe9dition) avec'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='point',
+ field=django.contrib.gis.db.models.fields.PointField(blank=True, dim=3, null=True, srid=4326, verbose_name='Point'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='x',
+ field=models.FloatField(blank=True, null=True, verbose_name='X/Long'),
+ ),
+ migrations.AlterField(
+ model_name='historicalbasefind',
+ name='y',
+ field=models.FloatField(blank=True, null=True, verbose_name='Y/Lat'),
+ ),
+ migrations.AlterField(
+ model_name='historicalfind',
+ name='circumference',
+ field=models.FloatField(blank=True, null=True, verbose_name='Circonf\xe9rence (cm)'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='executed',
+ field=models.BooleanField(default=False, verbose_name='Le traitement a \xe9t\xe9 r\xe9alis\xe9'),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='image',
+ field=models.TextField(blank=True, help_text='La taille maximale support\xe9e pour le fichier est de 100 Mo.', max_length=255, null=True),
+ ),
+ migrations.AlterField(
+ model_name='historicaltreatment',
+ name='thumbnail',
+ field=models.TextField(blank=True, help_text='La taille maximale support\xe9e pour le fichier est de 100 Mo.', max_length=255, null=True),
+ ),
+ migrations.AlterField(
+ model_name='treatment',
+ name='executed',
+ field=models.BooleanField(default=False, verbose_name='Le traitement a \xe9t\xe9 r\xe9alis\xe9'),
+ ),
+ migrations.AlterField(
+ model_name='treatment',
+ name='image',
+ field=models.ImageField(blank=True, help_text='La taille maximale support\xe9e pour le fichier est de 100 Mo.', max_length=255, null=True, upload_to=ishtar_common.models.get_image_path),
+ ),
+ migrations.AlterField(
+ model_name='treatment',
+ name='main_image',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='main_image_treatments', to='ishtar_common.Document', verbose_name='Image principale'),
+ ),
+ migrations.AlterField(
+ model_name='treatment',
+ name='thumbnail',
+ field=models.ImageField(blank=True, help_text='La taille maximale support\xe9e pour le fichier est de 100 Mo.', max_length=255, null=True, upload_to=ishtar_common.models.get_image_path),
+ ),
+ migrations.AlterField(
+ model_name='treatmentfile',
+ name='main_image',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='main_image_treatment_files', to='ishtar_common.Document', verbose_name='Image principale'),
+ ),
+ migrations.AlterField(
+ model_name='treatmentstate',
+ name='executed',
+ field=models.BooleanField(default=False, verbose_name='Le traitement est r\xe9alis\xe9'),
+ ),
+ migrations.AlterField(
+ model_name='treatmenttype',
+ name='change_current_location',
+ field=models.BooleanField(default=False, help_text='Le traitement change la localisation actuelle.', verbose_name='Change la localisation actuelle'),
+ ),
+ migrations.AlterField(
+ model_name='treatmenttype',
+ name='change_reference_location',
+ field=models.BooleanField(default=False, help_text='Le traitement change la localisation de r\xe9f\xe9rence.', verbose_name='Change la localisation de r\xe9f\xe9rence'),
+ ),
+ migrations.AlterField(
+ model_name='treatmenttype',
+ name='create_new_find',
+ field=models.BooleanField(default=False, help_text="Si mis \xe0 Vrai quand le traitement est appliqu\xe9 une nouvelle version de l'objet sera cr\xe9\xe9e.", verbose_name='Cr\xe9er un nouvel \xe9l\xe9ment'),
+ ),
+ migrations.AlterField(
+ model_name='treatmenttype',
+ name='destructive',
+ field=models.BooleanField(default=False, verbose_name='Destructif'),
+ ),
+ migrations.AlterField(
+ model_name='treatmenttype',
+ name='restore_reference_location',
+ field=models.BooleanField(default=False, help_text='Le traitement restaure la localisation de r\xe9f\xe9rence sur la localisation actuelle.', verbose_name='Restaure la localisation de r\xe9f\xe9rence'),
+ ),
+ ]
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 9d16cb66b..01f4b719f 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -39,7 +39,7 @@ from ishtar_common.models import Document, GeneralType, \
HierarchicalType, BaseHistorizedItem, LightHistorizedItem, \
HistoricalRecords, OwnPerms, Person, Basket, post_save_cache, \
ValueGetter, get_current_profile, IshtarSiteProfile, PRIVATE_FIELDS, \
- SpatialReferenceSystem, BulkUpdatedItem, ExternalIdManager, QuickAction, \
+ GeoItem, BulkUpdatedItem, ExternalIdManager, QuickAction, \
MainItem, document_attached_changed, HistoryModel, DynamicRequest, \
SearchAltName
@@ -264,7 +264,7 @@ class BFBulkView(object):
"""
-class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms):
+class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms):
EXTERNAL_ID_KEY = 'base_find_external_id'
EXTERNAL_ID_DEPENDENCIES = ['find']
SLUG = 'basefind'
@@ -292,32 +292,8 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms):
topographic_localisation = models.CharField(
_(u"Point of topographic reference"), blank=True, null=True,
max_length=120)
- x = models.FloatField(_(u'X'), blank=True, null=True)
- y = models.FloatField(_(u'Y'), blank=True, null=True)
- z = models.FloatField(_(u'Z'), blank=True, null=True)
- estimated_error_x = models.FloatField(_(u'Estimated error for X'),
- blank=True, null=True)
- estimated_error_y = models.FloatField(_(u'Estimated error for Y'),
- blank=True, null=True)
- estimated_error_z = models.FloatField(_(u'Estimated error for Z'),
- blank=True, null=True)
- spatial_reference_system = models.ForeignKey(
- SpatialReferenceSystem, verbose_name=_(u"Spatial Reference System"),
- on_delete=models.SET_NULL,
- blank=True, null=True)
- point_2d = models.PointField(_(u"Point (2D)"), blank=True, null=True)
- point = models.PointField(_(u"Point (3D)"), blank=True, null=True, dim=3)
- point_source = models.CharField(
- _(u"Point source"),
- choices=(('T', _(u"Town")), ('P', _(u"Precise"))), max_length=1,
- blank=True, null=True)
+ # gis
line = models.LineStringField(_(u"Line"), blank=True, null=True)
- multi_polygon = models.MultiPolygonField(_(u"Multi polygon"), blank=True,
- null=True)
- multi_polygon_source = models.CharField(
- _(u"Multi-polygon source"),
- choices=(('T', _(u"Town")), ('P', _(u"Precise"))), max_length=1,
- blank=True, null=True)
cache_short_id = models.TextField(
_(u"Short ID"), blank=True, null=True, db_index=True,
help_text=_(u"Cached value - do not edit"))
@@ -369,6 +345,12 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms):
def get_town_polygons(self):
return self.context_record.get_town_polygons()
+ def get_precise_points(self):
+ precise_points = super(BaseFind, self).get_precise_points()
+ if precise_points:
+ return precise_points
+ return self.context_record.get_precise_points()
+
def generate_index(self):
"""
Generate index based on operation or context record (based on