summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index a88a7d161..1bb09717d 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -25,7 +25,7 @@ from django.conf import settings
from django.contrib.gis.db import models
from django.contrib.postgres.indexes import GinIndex
from django.contrib.sites.models import Site
-from django.db import connection, transaction, OperationalError, IntegrityError
+from django.db import transaction, OperationalError, IntegrityError
from django.db.models import Q
from django.db.models.signals import post_delete, post_save, m2m_changed
from django.urls import reverse
@@ -37,7 +37,7 @@ from ishtar_common.utils import (
cached_label_changed,
m2m_historization_changed,
post_save_geo,
- task,
+ SearchAltName,
)
from ishtar_common.models import (
@@ -58,7 +58,6 @@ from ishtar_common.models import (
get_current_profile,
document_attached_changed,
HistoryModel,
- SearchAltName,
GeoItem,
CompleteIdentifierItem,
SearchVectorConfig,
@@ -826,6 +825,7 @@ class ContextRecord(
"town_label_with_areas",
]
UPPER_GEO = ["operation", "archaeological_site"]
+ UPPER_PERMISSIONS = [(Operation, "operation_id")]
history = HistoricalRecords(bases=[HistoryModel])
objects = UUIDModelManager()
@@ -1214,6 +1214,10 @@ class ContextRecord(
return actions
@classmethod
+ def get_limit_to_area_query(cls, town_ids):
+ return Q(operation__towns__pk__in=town_ids)
+
+ @classmethod
def get_query_owns(cls, ishtaruser):
return (
cls._construct_query_own(