[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:
+10
-6
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user