diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-06-09 15:54:37 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-06-09 15:54:37 +0200 |
commit | cccde539177da309bc3af5549bccaa65aca172ca (patch) | |
tree | 5425af50059702a998a0772b04e56b261cec96c5 /ishtar_common/models_common.py | |
parent | 3091cfde5a536750bfeedcbe12a8891f898eb159 (diff) | |
download | Ishtar-cccde539177da309bc3af5549bccaa65aca172ca.tar.bz2 Ishtar-cccde539177da309bc3af5549bccaa65aca172ca.zip |
custom index: "whole_db" key is available for index on the whole db
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index fd1a00d95..ac42e5ee6 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -3021,6 +3021,14 @@ class CompleteIdentifierItem(models.Model, ImageContainerModel): complete_identifier = getattr(self, cached_label_key) return complete_identifier + def get_index_whole_db(self): + q = self.__class__.objects.exclude(custom_index__isnull=True) + q = q.order_by("-custom_index") + if q.count(): + current_index = q.values_list("custom_index", flat=True).all()[0] + return current_index + 1 + return 1 + def generate_custom_index(self, force=False): if not self.pk: return |