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