diff options
| -rw-r--r-- | archaeological_warehouse/models.py | 24 | ||||
| -rw-r--r-- | example_project/settings.py | 3 | ||||
| -rw-r--r-- | ishtar_common/data_importer.py | 2 | ||||
| -rw-r--r-- | ishtar_common/models_imports.py | 1 | 
4 files changed, 11 insertions, 19 deletions
| diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 25a57c4ae..db08c3467 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1380,20 +1380,12 @@ class Container(DocumentItem, Merge, LightHistorizedItem,              q = q.exclude(id=self.id)          if self.index and not q.count():              return -        if settings.ISHTAR_CONTAINER_INDEX == "general": -            q = Container.objects -            if q.count(): -                self.index = int( -                    q.all().aggregate(Max("index"))["index__max"] or 0) + 1 -            else: -                self.index = 1 -        else:  # default is index by warehouse -            q = Container.objects.filter(location=self.location) -            if q.count(): -                self.index = int( -                    q.all().aggregate(Max("index"))["index__max"]) + 1 -            else: -                self.index = 1 +        q = Container.objects.filter(location=self.location) +        if q.count(): +            self.index = int( +                q.all().aggregate(Max("index"))["index__max"]) + 1 +        else: +            self.index = 1          if not self.cached_division:              self.cached_division = self._generate_cached_division() @@ -1418,8 +1410,8 @@ class Container(DocumentItem, Merge, LightHistorizedItem,          if not self.index and not self.container_type.stationary:              self.skip_history_when_saving = True              q = Container.objects.filter( -                responsibility=self.responsibility).exclude( -                pk=self.pk).order_by('-index') +                location=self.location +            ).exclude(pk=self.pk).order_by('-index')              self.index = q.all()[0].index + 1 if q.count() else 1              updated = True diff --git a/example_project/settings.py b/example_project/settings.py index d7c382f71..8e2ad2e01 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -293,9 +293,6 @@ ISHTAR_SEARCH_LANGUAGE = "french"  ISHTAR_SECURE = True -# index by warehouse or on the whole database -ISHTAR_CONTAINER_INDEX = 'warehouse'  #  or "general" -  ISHTAR_DPTS = []  MAX_ATTEMPTS = 1  # django background tasks diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index f48651ac7..b0d6a539d 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1182,6 +1182,8 @@ class Importer(object):          obj, created = self.get_object(self.OBJECT_CLS, data)          if self.simulate:              return data +        # print(data) +        # print(self._defaults)          if self.import_instance:              self.import_instance.add_imported_line(self.idx_line) diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index 3bb6c50b8..b3b64bd65 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -726,6 +726,7 @@ TARGET_MODELS = [      ('ishtar_common.models.PersonType', _("Person type")),      ('TitleType', _("Title")),      ('SourceType', _("Source type")), +    ('ishtar_common.models.SourceType', _("Source type")),      ('AuthorType', _("Author type")),      ('Format', _("Format")),      ('ishtar_common.models.Format', _("Format")), | 
