summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index ac3755e13..e841690bb 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2714,19 +2714,21 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
# other will be symbolic links
RELATED_MODELS = [
'treatment_files', 'treatments', 'finds', 'context_records',
- 'operations', 'sites', 'warehouses', 'containers', 'files'
+ 'operations', 'sites', 'warehouses', 'containers', 'files',
+ 'administrativeacts',
]
# same fields but in order for forms
RELATED_MODELS_ALT = [
'finds', 'context_records', 'operations', 'sites', 'files',
- 'warehouses', 'containers', 'treatments', 'treatment_files',
+ 'administrativeacts', 'warehouses', 'containers', 'treatments',
+ 'treatment_files',
]
SLUG = 'document'
LINK_SPLIT = "<||>"
GET_VALUES_EXCLUDE_FIELDS = ValueGetter.GET_VALUES_EXCLUDE_FIELDS + [
"warehouses", "operations", "treatments",
- "files", "treatment_files", "id",
+ "files", "treatment_files", "administrativeacts", "id",
"associated_links", "source_type_id",
"history_creator_id", "containers", "sites",
"main_image_warehouses", "main_image_operations",
@@ -2977,6 +2979,7 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
('warehouse', 'warehouses__pk'),
('treatment', 'treatments__pk'),
('treatmentfile', 'treatment_files__pk'),
+ ('administrativeact', 'administrativeacts__pk'),
]
UP_MODEL_QUERY = {
@@ -3239,10 +3242,7 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
def public_representation(self):
site = Site.objects.get_current()
- if settings.ISHTAR_SECURE:
- scheme = "https"
- else:
- scheme = "http"
+ scheme = "https" if settings.ISHTAR_SECURE else "http"
base_url = scheme + "://" + site.domain + "/"
image = None
if self.image:
@@ -3334,10 +3334,7 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
@property
def has_related(self):
- for rel in self.RELATED_MODELS:
- if getattr(self, rel).count():
- return True
- return False
+ return any(getattr(self, rel).count() for rel in self.RELATED_MODELS)
@classmethod
def get_query_owns(cls, ishtaruser):