diff --git a/compensation/forms/modals/payment.py b/compensation/forms/modals/payment.py index 0046838c..eed2e702 100644 --- a/compensation/forms/modals/payment.py +++ b/compensation/forms/modals/payment.py @@ -77,8 +77,11 @@ class NewPaymentForm(BaseModalForm): is_valid (bool): True if valid, False otherwise """ super_valid = super().is_valid() - date = self.cleaned_data["due"] - comment = self.cleaned_data["comment"] or None + if not super_valid: + return super_valid + + date = self.cleaned_data.get("due", None) + comment = self.cleaned_data.get("comment", None) if not date and not comment: # At least one needs to be set! self.add_error(