diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2019-02-06 14:25:30 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:38:56 +0200 |
commit | 172eb15954d2403831b073c785c38cac84505927 (patch) | |
tree | 7d2e9da91f30d86a408ec1cc6d984997993a4bfd /archaeological_finds/models_finds.py | |
parent | 06747b5bef984838030667cf3b17e466cf5d27f7 (diff) | |
download | Ishtar-172eb15954d2403831b073c785c38cac84505927.tar.bz2 Ishtar-172eb15954d2403831b073c785c38cac84505927.zip |
Geo: manage autogen of polygons
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index da872ab53..3f0ade1df 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -30,7 +30,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext_lazy as _, pgettext_lazy\ from ishtar_common.data_importer import post_importer_action, ImporterError -from ishtar_common.utils import cached_label_changed, post_save_point, \ +from ishtar_common.utils import cached_label_changed, post_save_geo, \ m2m_historization_changed from ishtar_common.alternative_configs import ALTERNATE_CONFIGS @@ -306,9 +306,17 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms): 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) 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")) @@ -357,6 +365,9 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms): def get_town_centroid(self): return self.context_record.get_town_centroid() + def get_town_polygons(self): + return self.context_record.get_town_polygons() + def generate_index(self): """ Generate index based on operation or context record (based on @@ -592,7 +603,7 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms): def post_save_basefind(sender, **kwargs): cached_label_changed(sender, **kwargs) - post_save_point(sender, **kwargs) + post_save_geo(sender, **kwargs) post_save.connect(post_save_basefind, sender=BaseFind) |