[Intervention] Revocations files optional #4

* makes revocation file upload optional
 * adds overview about revocations to intervention index
 * adds/updates translations
This commit is contained in:
mipel
2021-08-26 15:02:34 +02:00
parent d5680c3bb0
commit c6fe002451
7 changed files with 217 additions and 167 deletions
+10 -6
View File
@@ -332,6 +332,7 @@ class NewRevocationForm(BaseModalForm):
file = forms.FileField(
label=_("Document"),
label_suffix=_(""),
required=False,
help_text=_("Must be smaller than 15 Mb"),
widget=forms.FileInput(
attrs={
@@ -371,12 +372,15 @@ class NewRevocationForm(BaseModalForm):
user=self.user,
action=UserAction.EDITED
)
document = Document.objects.create(
title="revocation_of_{}".format(self.instance.identifier),
date_of_creation=self.cleaned_data["date"],
comment=self.cleaned_data["comment"],
file=self.cleaned_data["file"],
)
if self.cleaned_data["file"]:
document = Document.objects.create(
title="revocation_of_{}".format(self.instance.identifier),
date_of_creation=self.cleaned_data["date"],
comment=self.cleaned_data["comment"],
file=self.cleaned_data["file"],
)
else:
document = None
revocation = Revocation.objects.create(
date=self.cleaned_data["date"],
comment=self.cleaned_data["comment"],