diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 6 | ||||
-rw-r--r-- | ishtar_common/views_item.py | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index dfcf503af..8d0545885 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3317,7 +3317,8 @@ class Document(OwnPerms, ImageModel, FullSearch, Imported): SLUG = 'document' LINK_SPLIT = u"<||>" - TABLE_COLS = ['title', 'source_type', 'cache_related_label', 'authors', + TABLE_COLS = ['title', 'source_type', 'cache_related_label', + 'authors__cached_label', 'associated_url'] COL_LINK = ['associated_url'] BASE_SEARCH_VECTORS = ['title', 'source_type__label', 'external_id', @@ -3327,6 +3328,8 @@ class Document(OwnPerms, ImageModel, FullSearch, Imported): BOOL_FIELDS = ['duplicate'] + COL_LABELS = {"authors__cached_label": _(u"Authors")} + CACHED_LABELS = ['cache_related_label'] EXTRA_REQUEST_KEYS = { "operations": "operations__pk", @@ -3337,6 +3340,7 @@ class Document(OwnPerms, ImageModel, FullSearch, Imported): "finds__base_finds__context_record__pk", "finds__base_finds__context_record__operation": "finds__base_finds__context_record__operation__pk", + 'authors__cached_label': 'authors__cached_label', } # alternative names of fields for searches diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 1b6d1e724..374dc3927 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -1120,8 +1120,15 @@ def get_item(model, func_name, default_name, extra_request_keys=[], for k in ks: if k.endswith("__pk"): k = k[:-len("__pk")] + "__label" - if '__' in k: - k = k.split('__')[0] + if k.endswith("towns"): + k = k + "__cached_label" + if k.endswith("__icontains") or \ + k.endswith("__contains") or \ + k.endswith("__iexact") or \ + k.endswith("__exact"): + k = '__'.join(k.split('__')[:-1]) + # if '__' in k: + # k = k.split('__')[0] orders.append(signe + k) else: # not a standard request key |