summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r--archaeological_warehouse/models.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 6de87ee36..a99db2ef7 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -186,9 +186,9 @@ class Warehouse(Address, DocumentItem, GeoItem, QRCodeItem, DashboardFormItem,
@property
def location_types(self):
return [
- wd.division.label
+ wd.container_type.label
for wd in WarehouseDivisionLink.objects.filter(
- warehouse=self).order_by('order').all()
+ warehouse=self).order_by('order').all() if wd.container_type
]
@property
@@ -326,7 +326,7 @@ class Warehouse(Address, DocumentItem, GeoItem, QRCodeItem, DashboardFormItem,
)
loca.delete()
container.save() # force label regeneration
- for container in list(item.owned_containers.all()):
+ for container in list(item.containers.all()):
if Container.objects.filter(index=container.index,
responsible=self).count():
container.index = Container.objects.filter(
@@ -400,7 +400,7 @@ post_delete.connect(post_save_cache, sender=ContainerType)
class WarehouseDivisionLink(models.Model):
RELATED_SET_NAME = "divisions"
- RELATED_ATTRS = ["order"]
+ RELATED_ATTRS = ["order", "container_type"]
RELATIVE_MODELS = {Warehouse: 'warehouse'}
warehouse = models.ForeignKey(Warehouse, related_name='divisions')
container_type = models.ForeignKey(ContainerType, blank=True, null=True)