diff options
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r-- | archaeological_files/models.py | 10 |
1 files changed, 6 insertions, 4 deletions
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 ( @@ -1059,6 +1057,10 @@ class File( 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, no_auth_check=False, query=False |