diff --git a/arkindex/documents/api/elements.py b/arkindex/documents/api/elements.py index f1eb993b517acb4c5e8195e2ed5a30abe5f65f9f..122b9e04102d9cb0ca780b04d86a5178474ce764 100644 --- a/arkindex/documents/api/elements.py +++ b/arkindex/documents/api/elements.py @@ -1019,7 +1019,7 @@ class ElementBulkCreate(CreateAPIView): # Use WKB representation to compare existing zones # to avoid comparing references or slower coordinates polygon.wkb: zone_id - for polygon, zone_id in Zone.objects.filter(image_id=image_id).values_list('polygon', 'id') + for polygon, zone_id in Zone.objects.using('default').filter(image_id=image_id).values_list('polygon', 'id') } # Retrieve or create required zones @@ -1046,6 +1046,7 @@ class ElementBulkCreate(CreateAPIView): int, ElementPath .objects + .using('default') .filter( path__last=self.element.id, element__type_id__in=set(element_data['type'] for element_data in elements)