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.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 5a28aaffe..1762674e8 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2717,9 +2717,8 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
"main_image_sites",
]
- TABLE_COLS = ['title', 'source_type', 'cache_related_label',
- 'authors__cached_label',
- 'associated_url']
+ _TABLE_COLS = ['title', 'source_type', 'cache_related_label',
+ 'authors__cached_label', 'associated_url']
COL_LINK = ['associated_url']
BASE_SEARCH_VECTORS = [
SearchVectorConfig("title"),
@@ -2747,7 +2746,10 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
BOOL_FIELDS = ['duplicate']
- COL_LABELS = {"authors__cached_label": _("Authors")}
+ COL_LABELS = {
+ "authors__cached_label": _("Authors"),
+ "complete_identifier": _("Identifier"),
+ }
CACHED_LABELS = ['cache_related_label']
EXTRA_REQUEST_KEYS = {
@@ -2760,6 +2762,7 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
"finds__base_finds__context_record__operation":
"finds__base_finds__context_record__operation__pk",
'authors__cached_label': 'authors__cached_label',
+ 'complete_identifier': 'complete_identifier',
'authors__person__pk': 'authors__person__pk',
"container_id": "container_id",
'publisher__pk': 'publisher__pk'
@@ -3083,6 +3086,14 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
def __str__(self):
return self.title
+ @classmethod
+ def TABLE_COLS(cls):
+ cols = cls._TABLE_COLS[:]
+ profile = get_current_profile()
+ if profile.document_complete_identifier:
+ cols = ["complete_identifier"] + cols
+ return cols
+
@property
def operation_codes(self):
Operation = apps.get_model("archaeological_operations", "Operation")
@@ -3406,7 +3417,7 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,
return " ; ".join(items)
def _generate_cache_related_label(self):
- return self.related_label()
+ return self.related_label()[:1000]
@classmethod
def get_next_index(cls):