#50 Overlaying geometries KOM + OEK

* removes unused messages
* adds geometry conflict message rendering for KOM and OEK
* removes unused methods in GeoReferencedMixin
* generalizes geometrical lookup for conflicts from overlaps to intersects
This commit is contained in:
2021-12-15 15:10:35 +01:00
parent f4541abf20
commit 41af455d09
9 changed files with 70 additions and 37 deletions

View File

@@ -7,6 +7,7 @@ Created on: 15.11.21
"""
from django.contrib.gis.db.models import MultiPolygonField
from django.db import models
from django.db.models import Q
from konova.models import BaseResource, UuidModel
@@ -37,9 +38,12 @@ class Geometry(BaseResource):
check_timestamp_obj = self.modified or self.created
ts = check_timestamp_obj.timestamp
overlapping_geoms = Geometry.objects.filter(
modified__timestamp__lte=ts,
geom__overlaps=self.geom,
)
Q(modified__timestamp__lte=ts) |
Q(created__timestamp__lte=ts),
geom__intersects=self.geom,
).exclude(
id=self.id
).distinct()
# Drop known conflicts for this object to replace with new ones
self.conflicts_geometries.all().delete()