allow creating a bill without resolution

This commit is contained in:
2023-10-27 09:29:40 +00:00
parent b12e7d8f16
commit 1c6c850689

View File

@@ -103,12 +103,13 @@ class BillCreateForm(forms.ModelForm):
file_field = cleaned_data.get("file_field")
# check if resolution exists
try:
Resolution.objects.get(id=resolution)
except:
raise ValidationError(
f"Es gibt keinen Beschluss mit dieser ID. (Eingegebene ID: {resolution})"
)
if resolution != "":
try:
Resolution.objects.get(id=resolution)
except:
raise ValidationError(
f"Es gibt keinen Beschluss mit dieser ID. (Eingegebene ID: {resolution})"
)
# check that amount is valid because invalid amount is a NoneType.
if amount: