diff --git a/compensation/forms/modalForms.py b/compensation/forms/modalForms.py
index a6e7df26..5368077c 100644
--- a/compensation/forms/modalForms.py
+++ b/compensation/forms/modalForms.py
@@ -18,7 +18,7 @@ from codelist.settings import CODELIST_BIOTOPES_ID, CODELIST_COMPENSATION_ACTION
CODELIST_COMPENSATION_ACTION_DETAIL_ID
from compensation.models import CompensationDocument, EcoAccountDocument
from konova.contexts import BaseContext
-from konova.forms import BaseModalForm, NewDocumentForm, RemoveModalForm
+from konova.forms import BaseModalForm, NewDocumentModalForm, RemoveModalForm
from konova.models import DeadlineType
from konova.utils.message_templates import FORM_INVALID, ADDED_COMPENSATION_STATE, ADDED_DEADLINE, \
ADDED_COMPENSATION_ACTION, PAYMENT_EDITED
@@ -443,9 +443,9 @@ class NewActionModalForm(BaseModalForm):
return action
-class NewCompensationDocumentForm(NewDocumentForm):
+class NewCompensationDocumentModalForm(NewDocumentModalForm):
document_model = CompensationDocument
-class NewEcoAccountDocumentForm(NewDocumentForm):
+class NewEcoAccountDocumentModalForm(NewDocumentModalForm):
document_model = EcoAccountDocument
\ No newline at end of file
diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py
index c4b5c2f5..95f4ac0b 100644
--- a/compensation/views/compensation.py
+++ b/compensation/views/compensation.py
@@ -6,7 +6,7 @@ from django.utils.translation import gettext_lazy as _
from compensation.forms.forms import NewCompensationForm, EditCompensationForm
from compensation.forms.modalForms import NewStateModalForm, NewDeadlineModalForm, NewActionModalForm, \
- NewCompensationDocumentForm, RemoveCompensationActionModalForm, RemoveCompensationStateModalForm
+ NewCompensationDocumentModalForm, RemoveCompensationActionModalForm, RemoveCompensationStateModalForm
from compensation.models import Compensation, CompensationState, CompensationAction, CompensationDocument
from compensation.tables import CompensationTable
from intervention.models import Intervention
@@ -276,7 +276,7 @@ def new_document_view(request: HttpRequest, id: str):
"""
comp = get_object_or_404(Compensation, id=id)
- form = NewCompensationDocumentForm(request.POST or None, request.FILES or None, instance=comp, request=request)
+ form = NewCompensationDocumentModalForm(request.POST or None, request.FILES or None, instance=comp, request=request)
return form.process_request(
request,
msg_success=DOCUMENT_ADDED,
diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py
index 08e01a61..d433d551 100644
--- a/compensation/views/eco_account.py
+++ b/compensation/views/eco_account.py
@@ -16,7 +16,7 @@ from django.shortcuts import render, get_object_or_404, redirect
from compensation.forms.forms import NewEcoAccountForm, EditEcoAccountForm
from compensation.forms.modalForms import NewStateModalForm, NewActionModalForm, NewDeadlineModalForm, \
- NewEcoAccountDocumentForm, RemoveCompensationActionModalForm, RemoveCompensationStateModalForm
+ NewEcoAccountDocumentModalForm, RemoveCompensationActionModalForm, RemoveCompensationStateModalForm
from compensation.models import EcoAccount, EcoAccountDocument, CompensationState, CompensationAction
from compensation.tables import EcoAccountTable
from intervention.forms.modalForms import NewDeductionModalForm, ShareModalForm, RemoveEcoAccountDeductionModalForm, \
@@ -24,7 +24,7 @@ from intervention.forms.modalForms import NewDeductionModalForm, ShareModalForm,
from konova.contexts import BaseContext
from konova.decorators import any_group_check, default_group_required, conservation_office_group_required, \
shared_access_required
-from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm, RecordModalForm, RemoveDeadlineModalForm
+from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentModalForm, RecordModalForm, RemoveDeadlineModalForm
from konova.models import Deadline
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
@@ -524,7 +524,7 @@ def new_document_view(request: HttpRequest, id: str):
"""
acc = get_object_or_404(EcoAccount, id=id)
- form = NewEcoAccountDocumentForm(request.POST or None, request.FILES or None, instance=acc, request=request)
+ form = NewEcoAccountDocumentModalForm(request.POST or None, request.FILES or None, instance=acc, request=request)
return form.process_request(
request,
msg_success=DOCUMENT_ADDED,
diff --git a/ema/forms.py b/ema/forms.py
index 5dc3bcfb..2f193605 100644
--- a/ema/forms.py
+++ b/ema/forms.py
@@ -15,7 +15,7 @@ from django.utils.translation import gettext_lazy as _
from compensation.forms.forms import AbstractCompensationForm, CompensationResponsibleFormMixin
from ema.models import Ema, EmaDocument
from intervention.models import Responsibility
-from konova.forms import SimpleGeomForm, NewDocumentForm
+from konova.forms import SimpleGeomForm, NewDocumentModalForm
from user.models import UserActionLogEntry
@@ -150,5 +150,5 @@ class EditEmaForm(NewEmaForm):
return self.instance
-class NewEmaDocumentForm(NewDocumentForm):
+class NewEmaDocumentModalForm(NewDocumentModalForm):
document_model = EmaDocument
\ No newline at end of file
diff --git a/ema/views.py b/ema/views.py
index 900dde7c..99c80be3 100644
--- a/ema/views.py
+++ b/ema/views.py
@@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
from compensation.forms.modalForms import NewStateModalForm, NewActionModalForm, NewDeadlineModalForm, \
RemoveCompensationActionModalForm, RemoveCompensationStateModalForm
from compensation.models import CompensationAction, CompensationState
-from ema.forms import NewEmaForm, EditEmaForm, NewEmaDocumentForm
+from ema.forms import NewEmaForm, EditEmaForm, NewEmaDocumentModalForm
from ema.tables import EmaTable
from intervention.forms.modalForms import ShareModalForm
from konova.contexts import BaseContext
@@ -356,7 +356,7 @@ def document_new_view(request: HttpRequest, id: str):
"""
ema = get_object_or_404(Ema, id=id)
- form = NewEmaDocumentForm(request.POST or None, request.FILES or None, instance=ema, request=request)
+ form = NewEmaDocumentModalForm(request.POST or None, request.FILES or None, instance=ema, request=request)
return form.process_request(
request,
msg_success=DOCUMENT_ADDED,
diff --git a/intervention/forms/modalForms.py b/intervention/forms/modalForms.py
index 8039b3ae..a8fa98de 100644
--- a/intervention/forms/modalForms.py
+++ b/intervention/forms/modalForms.py
@@ -19,7 +19,7 @@ from django.utils.translation import gettext_lazy as _
from compensation.models import EcoAccount, EcoAccountDeduction
from intervention.inputs import TextToClipboardInput
from intervention.models import Intervention, InterventionDocument, RevocationDocument
-from konova.forms import BaseModalForm, NewDocumentForm, RemoveModalForm
+from konova.forms import BaseModalForm, NewDocumentModalForm, RemoveModalForm
from konova.utils.general import format_german_float
from konova.utils.user_checks import is_default_group_only
@@ -170,32 +170,6 @@ class NewRevocationModalForm(BaseModalForm):
"enctype": "multipart/form-data", # important for file upload
}
- def is_valid(self):
- super_valid = super().is_valid()
-
- _file = self.cleaned_data.get("file", None)
-
- if isinstance(_file, FieldFile):
- # FieldFile declares that no new file has been uploaded and we do not need to check on the file again
- return super_valid
-
- mime_type_valid = self.document_model.is_mime_type_valid(_file)
- if not mime_type_valid:
- self.add_error(
- "file",
- FILE_TYPE_UNSUPPORTED
- )
-
- file_size_valid = self.document_model.is_file_size_valid(_file)
- if not file_size_valid:
- self.add_error(
- "file",
- FILE_SIZE_TOO_LARGE
- )
-
- file_valid = mime_type_valid and file_size_valid
- return super_valid and file_valid
-
def save(self):
revocation = self.instance.add_revocation(self)
self.instance.mark_as_edited(self.user, self.request, edit_comment=REVOCATION_ADDED)
@@ -543,5 +517,5 @@ class RemoveEcoAccountDeductionModalForm(RemoveModalForm):
self.deduction.delete()
-class NewInterventionDocumentForm(NewDocumentForm):
+class NewInterventionDocumentModalForm(NewDocumentModalForm):
document_model = InterventionDocument
diff --git a/intervention/templates/intervention/detail/includes/documents.html b/intervention/templates/intervention/detail/includes/documents.html
index f536f154..93309f5c 100644
--- a/intervention/templates/intervention/detail/includes/documents.html
+++ b/intervention/templates/intervention/detail/includes/documents.html
@@ -27,7 +27,10 @@
{% trans 'Title' %}
|
-
+ |
+ {% trans 'Created on' %}
+ |
+
{% trans 'Comment' %}
|
{% if is_default_member and has_access %}
@@ -43,18 +46,26 @@
{% for doc in obj.documents.all %}
-
+
{{ doc.title }}
|
+
+
+ {{ doc.date_of_creation }}
+
+ |
{{ doc.comment }}
|
-
+ |
{% if is_default_member and has_access %}
- |