summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne@peacefrogs.net>2019-02-06 14:25:30 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-04-24 19:38:56 +0200
commit9f4e59e66686651b30a2e7976ba139627adabe22 (patch)
tree7d2e9da91f30d86a408ec1cc6d984997993a4bfd /archaeological_finds
parentd561cf06f45360939e64221fbbc6046b12b7d22a (diff)
downloadIshtar-9f4e59e66686651b30a2e7976ba139627adabe22.tar.bz2
Ishtar-9f4e59e66686651b30a2e7976ba139627adabe22.zip
Geo: manage autogen of polygons
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/migrations/0060_auto_20190206_1423.py35
-rw-r--r--archaeological_finds/models_finds.py15
2 files changed, 48 insertions, 2 deletions
diff --git a/archaeological_finds/migrations/0060_auto_20190206_1423.py b/archaeological_finds/migrations/0060_auto_20190206_1423.py
new file mode 100644
index 000000000..6ddfa5145
--- /dev/null
+++ b/archaeological_finds/migrations/0060_auto_20190206_1423.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2019-02-06 14:23
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_finds', '0059_auto_20190204_1134'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='basefind',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='basefind',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ migrations.AddField(
+ model_name='historicalbasefind',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='historicalbasefind',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ ]
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)