summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py36
1 files changed, 9 insertions, 27 deletions
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