From 4f60b4805a7eac04c2a8ec2116a245dbeec3c822 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 14 Feb 2025 17:49:37 +0100 Subject: ✨ generate_permissions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit manage: - possession (direct, creation, basket) - heritage - areas association - requests ({USER} special syntax) --- archaeological_context_records/models.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'archaeological_context_records/models.py') 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() @@ -1213,6 +1213,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 ( -- cgit v1.2.3