From 4e9a9be6988c49f82a81cfcef8ae4409b130d300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Fri, 31 Mar 2023 11:18:12 +0200 Subject: [PATCH] fix cost unit validation --- contracts/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/models.py b/contracts/models.py index 8dccd01..4fcc486 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -607,13 +607,13 @@ class Contract(NameStrMixin, models.Model): {"cost_amount": "Nemůže být definováno bez jednoty nákladů."} ) - if self.cost_unit == self.CostUnits.OTHER[1] and not self.cost_unit_other: + if self.cost_unit == self.CostUnits.OTHER and not self.cost_unit_other: raise ValidationError( { "cost_unit_other": "Musí být definováno, pokud je vybrána jednotka nákladů 'jiné'." } ) - elif self.cost_unit != self.CostUnits.OTHER[1] and self.cost_unit_other: + elif self.cost_unit != self.CostUnits.OTHER and self.cost_unit_other: raise ValidationError( { "cost_unit_other": "Nemůže být definováno, pokud není vybrána jednotka nákladů 'jiné'." -- GitLab