diff options
| -rw-r--r-- | archaeological_warehouse/forms.py | 2 | ||||
| -rw-r--r-- | archaeological_warehouse/models.py | 13 | 
2 files changed, 10 insertions, 5 deletions
| diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index cc21f65f6..d51dcf1f4 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -183,7 +183,7 @@ class ContainerModifyForm(ContainerForm):          self.fields.keyOrder.pop(self.fields.keyOrder.index('index'))          self.fields.keyOrder.insert(              self.fields.keyOrder.index("location") + 1, 'index') -        ) +  class ContainerSelect(TableSelect):      location = get_warehouse_field() diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index d272a833a..698c475f8 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -135,7 +135,8 @@ post_delete.connect(post_save_cache, sender=ContainerType)  class Container(LightHistorizedItem): -    TABLE_COLS = ['reference', 'container_type__label', 'location__name'] +    TABLE_COLS = ['reference', 'container_type__label', 'cached_location', +                  'precise_location']      # search parameters      EXTRA_REQUEST_KEYS = { @@ -144,6 +145,10 @@ class Container(LightHistorizedItem):          'reference': 'reference__icontains',      }      SHOW_URL = 'show-container' +    COL_LABELS = { +        'cached_location': _(u"Location - index"), +        'precise_location': _(u"Precise localisation"), +    }      CACHED_LABELS = ['cached_label', 'cached_location']      # fields @@ -176,7 +181,7 @@ class Container(LightHistorizedItem):          return cached_label      def _generate_cached_location(self): -        items = [self.location, self.index] +        items = [self.location.name, unicode(self.index)]          cached_label = u" - ".join(items)          return cached_label @@ -189,7 +194,7 @@ class Container(LightHistorizedItem):      @property      def precise_location(self): -        location = unicode(self.location) +        location = self.location.name          locas = [              u"{} {}".format(loca.division.division, loca.reference)              for loca in ContainerLocalisation.objects.filter( @@ -233,4 +238,4 @@ class ContainerLocalisation(models.Model):      def save(self, *args, **kwargs):          super(ContainerLocalisation, self).save(*args, **kwargs) -        cached_label_changed(Container, {'instance': self.container}) +        cached_label_changed(Container, instance=self.container) | 
