diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-11-24 17:37:21 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:21 +0100 | 
| commit | 4aa96a151c83e837f9a76983b2aef4a70941a517 (patch) | |
| tree | 319455e933c1270aba23df9b9c6eaa7155bdc4c8 /ishtar_common/models.py | |
| parent | a9e3eee6ac90e7811a629b46c14d498e74fe8738 (diff) | |
| download | Ishtar-4aa96a151c83e837f9a76983b2aef4a70941a517.tar.bz2 Ishtar-4aa96a151c83e837f9a76983b2aef4a70941a517.zip  | |
Document: display complete identifier on sheet and tables
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 21 | 
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):  | 
