diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2019-02-06 14:25:30 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:27 +0200 |
commit | cfabd636d0a6d84e8377be3e4d041b4e75ddda9a (patch) | |
tree | 6c6f299e3b8d17e6c0f3bac1f2cdc0db2082b123 /archaeological_operations | |
parent | 930b7cdac5a2bf80ed4838e7835273f5816b819e (diff) | |
download | Ishtar-cfabd636d0a6d84e8377be3e4d041b4e75ddda9a.tar.bz2 Ishtar-cfabd636d0a6d84e8377be3e4d041b4e75ddda9a.zip |
Geo: manage autogen of polygons
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/migrations/0050_auto_20190206_1423.py | 55 | ||||
-rw-r--r-- | archaeological_operations/models.py | 14 |
2 files changed, 69 insertions, 0 deletions
diff --git a/archaeological_operations/migrations/0050_auto_20190206_1423.py b/archaeological_operations/migrations/0050_auto_20190206_1423.py new file mode 100644 index 000000000..a632b6059 --- /dev/null +++ b/archaeological_operations/migrations/0050_auto_20190206_1423.py @@ -0,0 +1,55 @@ +# -*- 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_operations', '0049_auto_20190122_1621'), + ] + + operations = [ + migrations.AddField( + model_name='archaeologicalsite', + 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='archaeologicalsite', + 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='historicalarchaeologicalsite', + 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='historicalarchaeologicalsite', + 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='historicaloperation', + 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='historicaloperation', + 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='operation', + 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='operation', + 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_operations/models.py b/archaeological_operations/models.py index 98be07abd..219589acf 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -398,6 +398,13 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, return return q.all()[0].poly, self._meta.verbose_name + def get_town_polygons(self): + q = self.towns.filter(limit__isnull=False).annotate( + poly=Union('limit')).all() + if not q.count(): + return None + return q.all()[0].poly + def _get_base_image_path(self): return u"{}/{}".format(self.SLUG, self.reference) @@ -1135,6 +1142,13 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, return None return q.all()[0].poly, self._meta.verbose_name + def get_town_polygons(self): + q = self.towns.filter(limit__isnull=False).annotate( + poly=Union('limit')).all() + if not q.count(): + return None + return q.all()[0].poly + def context_record_relations_q(self): from archaeological_context_records.models \ import RecordRelations as CRRL |