summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-14 17:49:37 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:43:48 +0100
commit4f60b4805a7eac04c2a8ec2116a245dbeec3c822 (patch)
tree561f87e11ae60c96320523c80c6317ff8f1d2f99 /archaeological_context_records/models.py
parent94f357939957dc8a5de453224913dbecdc4dc9db (diff)
downloadIshtar-4f60b4805a7eac04c2a8ec2116a245dbeec3c822.tar.bz2
Ishtar-4f60b4805a7eac04c2a8ec2116a245dbeec3c822.zip
✨ generate_permissions
manage: - possession (direct, creation, basket) - heritage - areas association - requests ({USER} special syntax)
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(