diff options
Diffstat (limited to 'archaeological_warehouse/forms.py')
-rw-r--r-- | archaeological_warehouse/forms.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 58d856844..94d37d092 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -318,14 +318,14 @@ class ContainerModifyForm(ContainerForm): # manage unique ID cleaned_data = super(ContainerModifyForm, self).clean() index = cleaned_data.get("index", None) - warehouse = cleaned_data.get("location") + warehouse = cleaned_data.get("responsible") if not index: - q = models.Container.objects.filter(location__pk=warehouse) + q = models.Container.objects.filter(responsible__pk=warehouse) if not q.count(): cleaned_data["index"] = 1 else: - cleaned_data["index"] = q.all().aggregate( - Max("index"))["index__max"] + 1 + cleaned_data["index"] = int(q.aggregate( + Max("index"))["index__max"]) + 1 else: q = models.Container.objects.filter( index=index, location__pk=warehouse) |