diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
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 |