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") file_field = cleaned_data.get("file_field")
# check if resolution exists # check if resolution exists
try: if resolution != "":
Resolution.objects.get(id=resolution) try:
except: Resolution.objects.get(id=resolution)
raise ValidationError( except:
f"Es gibt keinen Beschluss mit dieser ID. (Eingegebene ID: {resolution})" raise ValidationError(
) f"Es gibt keinen Beschluss mit dieser ID. (Eingegebene ID: {resolution})"
)
# check that amount is valid because invalid amount is a NoneType. # check that amount is valid because invalid amount is a NoneType.
if amount: if amount: