Merge pull request 'master' (#213) from master into Docker
Reviewed-on: SGD-Nord/konova#213
This commit is contained in:
commit
45a383cf85
@ -9,6 +9,7 @@ Created on: 24.01.22
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from django.contrib.gis.geos import MultiPolygon
|
from django.contrib.gis.geos import MultiPolygon
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
|
|
||||||
from api.utils.serializer.serializer import AbstractModelAPISerializer
|
from api.utils.serializer.serializer import AbstractModelAPISerializer
|
||||||
@ -80,10 +81,14 @@ class AbstractModelAPISerializerV1(AbstractModelAPISerializer):
|
|||||||
json_str = str(json_str)
|
json_str = str(json_str)
|
||||||
if len(json_str) == 0:
|
if len(json_str) == 0:
|
||||||
return None
|
return None
|
||||||
code = KonovaCode.objects.get(
|
try:
|
||||||
atom_id=json_str,
|
code = KonovaCode.objects.get(
|
||||||
code_lists__in=[code_list_identifier]
|
atom_id=json_str,
|
||||||
)
|
code_lists__in=[code_list_identifier]
|
||||||
|
)
|
||||||
|
except ObjectDoesNotExist as e:
|
||||||
|
msg = f"{e.args[0]} ({json_str} not found in official list {code_list_identifier})"
|
||||||
|
raise ObjectDoesNotExist(msg)
|
||||||
return code
|
return code
|
||||||
|
|
||||||
def _created_on_to_json(self, entry):
|
def _created_on_to_json(self, entry):
|
||||||
|
@ -698,18 +698,16 @@ class GeoReferencedMixin(models.Model):
|
|||||||
return request
|
return request
|
||||||
|
|
||||||
instance_objs = []
|
instance_objs = []
|
||||||
add_message = False
|
|
||||||
conflicts = self.geometry.conflicts_geometries.all()
|
conflicts = self.geometry.conflicts_geometries.all()
|
||||||
|
|
||||||
for conflict in conflicts:
|
for conflict in conflicts:
|
||||||
instance_objs += conflict.affected_geometry.get_data_objects()
|
instance_objs += conflict.affected_geometry.get_data_objects()
|
||||||
add_message = True
|
|
||||||
|
|
||||||
conflicts = self.geometry.conflicted_by_geometries.all()
|
conflicts = self.geometry.conflicted_by_geometries.all()
|
||||||
for conflict in conflicts:
|
for conflict in conflicts:
|
||||||
instance_objs += conflict.conflicting_geometry.get_data_objects()
|
instance_objs += conflict.conflicting_geometry.get_data_objects()
|
||||||
add_message = True
|
|
||||||
|
|
||||||
|
add_message = len(instance_objs) > 0
|
||||||
if add_message:
|
if add_message:
|
||||||
instance_identifiers = [x.identifier for x in instance_objs]
|
instance_identifiers = [x.identifier for x in instance_objs]
|
||||||
instance_identifiers = ", ".join(instance_identifiers)
|
instance_identifiers = ", ".join(instance_identifiers)
|
||||||
|
Loading…
Reference in New Issue
Block a user