diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-09 18:02:41 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:24 +0100 | 
| commit | daed3aa1cdb63cea7ac97f1d7da838df465fc925 (patch) | |
| tree | 64334c9307509607b65394e83ae0654f790f98cb /archaeological_warehouse/models.py | |
| parent | 939918a683bff6a18cabcd83764e9db8dfd0183a (diff) | |
| download | Ishtar-daed3aa1cdb63cea7ac97f1d7da838df465fc925.tar.bz2 Ishtar-daed3aa1cdb63cea7ac97f1d7da838df465fc925.zip | |
Container: collection -> responsibility. Deactivate collection fot finds
Diffstat (limited to 'archaeological_warehouse/models.py')
| -rw-r--r-- | archaeological_warehouse/models.py | 18 | 
1 files changed, 11 insertions, 7 deletions
| diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 7112e6830..71c6a8145 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -685,6 +685,10 @@ class Container(DocumentItem, Merge, LightHistorizedItem,              pgettext_lazy("key for text search", "location"),              'location__name__iexact'          ), +        'responsibility_name': SearchAltName( +            pgettext_lazy("key for text search", "responsibility"), +            'responsibility__name__iexact' +        ),          'container_type': SearchAltName(              pgettext_lazy("key for text search", "type"),              'container_type__label__iexact' @@ -854,9 +858,9 @@ class Container(DocumentItem, Merge, LightHistorizedItem,          related_name='owned_containers', blank=True, null=True,          help_text=_("Deprecated - do not use")      ) -    collection = models.ForeignKey( -        Warehouse, verbose_name=_("Collection"), -        related_name='collections', blank=True, null=True, +    responsibility = models.ForeignKey( +        Warehouse, verbose_name=_("Responsibility"), +        related_name='responsibilities', blank=True, null=True,          help_text=_("Warehouse that own the container")      )      container_type = models.ForeignKey(ContainerType, @@ -1364,11 +1368,11 @@ class Container(DocumentItem, Merge, LightHistorizedItem,      def pre_save(self):          if self.parent == self:              self.parent = None -        if not self.collection_id and not self.collection: +        if not self.responsibility_id and not self.responsibility:              if self.location_id: -                self.collection_id = self.location_id -            else: -                self.collection = self.location +                self.responsibility_id = self.location_id +            if self.location: +                self.responsibility = self.location          if self.container_type.stationary:              return          q = Container.objects.filter(index=self.index, location=self.location) | 
