master #537

Merged
mpeltriaux merged 10 commits from master into Docker 2026-05-10 10:15:14 +00:00
Showing only changes of commit b721e9c51c - Show all commits

View File

@@ -10,9 +10,11 @@ from abc import abstractmethod
from django.contrib.gis import geos
from django.contrib.gis.geos import GEOSGeometry
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import Paginator
from django.db.models import Q
from api.models import ExternalIdentifier
from konova.models import Geometry
from konova.utils.message_templates import DATA_UNSHARED
@@ -76,6 +78,14 @@ class AbstractModelAPISerializer:
del self.lookup["id"]
else:
# Return certain object
## But first check, whether this is an external identifier ...
try:
## If we can find this _id on our ExternalIdentifier model, we need to map it on the internal id
ext_id = ExternalIdentifier.objects.get(external_id=_id)
_id = ext_id.internal_id
except ObjectDoesNotExist:
# If we did not find it, we assume that this is already an internal id. (Or it does not exist at all)
pass
self.lookup["id"] = _id
self.shared_lookup = Q(