diff options
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 |