diff --git a/contracts/models.py b/contracts/models.py index 1c1ca21b41261f43ddabe2ae3680cc2d1d70ae47..8dccd010af8591b328ebb378774ace725f8a8262 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -607,16 +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 self.cost_unit_other is None: + if self.cost_unit == self.CostUnits.OTHER[1] 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 is not None - ): + elif self.cost_unit != self.CostUnits.OTHER[1] and self.cost_unit_other: raise ValidationError( { "cost_unit_other": "Nemůže být definováno, pokud není vybrána jednotka nákladů 'jiné'." diff --git a/contracts/templates/contracts/index.html b/contracts/templates/contracts/index.html index 834f0daf72e8354a96d925971d24754a6b53ba9d..be8f19368dbd3a8b019ba6004f4b35e5276a24ce 100644 --- a/contracts/templates/contracts/index.html +++ b/contracts/templates/contracts/index.html @@ -60,6 +60,7 @@ <h2 class="head-alt-md font-bold"> Všechny smlouvy </h2> + {% if request.user.can_create_contracts %} <a class="btn btn--inline-icon"