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_files/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'archaeological_files/models.py') diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 778b1c251..b3815c95d 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -27,7 +27,7 @@ from django.contrib.gis.db import models from django.contrib.postgres.indexes import GinIndex from django.core.cache import cache from django.core.validators import MinValueValidator, MaxValueValidator -from django.db.models import Max +from django.db.models import Q, Max from django.db.models.signals import post_save, m2m_changed, post_delete from django.urls import reverse @@ -41,6 +41,7 @@ from ishtar_common.utils import ( get_current_year, get_generated_id, m2m_historization_changed, + SearchAltName, ) from ishtar_common.models import ( @@ -53,7 +54,6 @@ from ishtar_common.models import ( Person, Organization, Town, - Dashboard, DashboardFormItem, HistoricalRecords, ValueGetter, @@ -62,11 +62,9 @@ from ishtar_common.models import ( post_save_cache, Document, HistoryModel, - SearchAltName, SearchVectorConfig, DocumentItem, CompleteIdentifierItem, - HierarchicalType, ) from archaeological_operations.models import ( @@ -1058,6 +1056,10 @@ class File( cache.set(cache_key, cls, settings.CACHE_TIMEOUT) return cls + @classmethod + def get_limit_to_area_query(cls, town_ids): + return Q(towns__pk__in=town_ids) | Q(main_town_id__in=town_ids) + @classmethod def get_owns( cls, user, menu_filtr=None, limit=None, values=None, get_short_menu_class=False, -- cgit v1.2.3