From 538d8d1ed2fd81ccc7234bac8d9ea88443baf9ec Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 8 Aug 2022 14:57:36 +0200 Subject: [PATCH 1/9] #190 Mandatory finished deadline * adds template message to indicate a finished-deadline is mandatory * adds finished deadline existance to quality check of compensation-like entries * adds proper warning to quality check result * extends tests --- compensation/models/compensation.py | 15 +++- .../compensation/includes/deadlines.html | 5 ++ .../eco_account/includes/deadlines.html | 5 ++ compensation/utils/quality.py | 11 +++ compensation/views/compensation.py | 1 + compensation/views/eco_account.py | 1 + .../ema/detail/includes/deadlines.html | 5 ++ ema/views.py | 1 + konova/tests/test_views.py | 21 ++++- locale/de/LC_MESSAGES/django.mo | Bin 43924 -> 44074 bytes locale/de/LC_MESSAGES/django.po | 78 +++++++++++------- 11 files changed, 106 insertions(+), 37 deletions(-) diff --git a/compensation/models/compensation.py b/compensation/models/compensation.py index 2e42ff7..e513c95 100644 --- a/compensation/models/compensation.py +++ b/compensation/models/compensation.py @@ -14,16 +14,14 @@ from user.models import User, Team from django.db import models, transaction from django.db.models import QuerySet, Sum from django.http import HttpRequest -from django.utils.translation import gettext_lazy as _ from compensation.managers import CompensationManager from compensation.models import CompensationState, CompensationAction from compensation.utils.quality import CompensationQualityChecker from konova.models import BaseObject, AbstractDocument, Deadline, generate_document_file_upload_path, \ - GeoReferencedMixin -from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE + GeoReferencedMixin, DeadlineType from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, COMPENSATION_REMOVED_TEMPLATE, \ - DOCUMENT_REMOVED_TEMPLATE, COMPENSATION_EDITED_TEMPLATE, DEADLINE_REMOVED, ADDED_DEADLINE, \ + DOCUMENT_REMOVED_TEMPLATE, DEADLINE_REMOVED, ADDED_DEADLINE, \ COMPENSATION_ACTION_REMOVED, COMPENSATION_STATE_REMOVED, INTERVENTION_HAS_REVOCATIONS_TEMPLATE from user.models import UserActionLogEntry @@ -226,6 +224,15 @@ class AbstractCompensation(BaseObject, GeoReferencedMixin): request = self.set_geometry_conflict_message(request) return request + def get_finished_deadlines(self): + """ Getter for FINISHED-deadlines + + Returns: + queryset (QuerySet): The finished deadlines + """ + return self.deadlines.filter( + type=DeadlineType.FINISHED + ) class CEFMixin(models.Model): """ Provides CEF flag as Mixin diff --git a/compensation/templates/compensation/detail/compensation/includes/deadlines.html b/compensation/templates/compensation/detail/compensation/includes/deadlines.html index 7f44565..bc54e95 100644 --- a/compensation/templates/compensation/detail/compensation/includes/deadlines.html +++ b/compensation/templates/compensation/detail/compensation/includes/deadlines.html @@ -20,6 +20,11 @@ + {% if not has_finished_deadlines %} +
+ {% trans 'Missing finished deadline ' %} +
+ {% endif %}
diff --git a/compensation/templates/compensation/detail/eco_account/includes/deadlines.html b/compensation/templates/compensation/detail/eco_account/includes/deadlines.html index beaecfd..c0b4daf 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deadlines.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deadlines.html @@ -20,6 +20,11 @@ + {% if not has_finished_deadlines %} +
+ {% trans 'Missing finished deadline ' %} +
+ {% endif %}
diff --git a/compensation/utils/quality.py b/compensation/utils/quality.py index b622fcd..f883ba3 100644 --- a/compensation/utils/quality.py +++ b/compensation/utils/quality.py @@ -19,6 +19,7 @@ class CompensationQualityChecker(AbstractQualityChecker): self._check_states() self._check_actions() self._check_geometry() + self._check_deadlines() self.valid = len(self.messages) == 0 def _check_states(self): @@ -47,6 +48,16 @@ class CompensationQualityChecker(AbstractQualityChecker): if not self.obj.actions.all(): self._add_missing_attr_name(_con("Compensation", "Actions")) + def _check_deadlines(self): + """ Checks data quality for related Deadline objects + + Returns: + + """ + finished_deadlines = self.obj.get_finished_deadlines() + if not finished_deadlines.exists(): + self._add_missing_attr_name(_("Finished deadlines")) + class EcoAccountQualityChecker(CompensationQualityChecker): def run_check(self): diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py index 31087ed..efe51ce 100644 --- a/compensation/views/compensation.py +++ b/compensation/views/compensation.py @@ -240,6 +240,7 @@ def detail_view(request: HttpRequest, id: str): "is_ets_member": in_group(_user, ETS_GROUP), "LANIS_LINK": comp.get_LANIS_link(), TAB_TITLE_IDENTIFIER: f"{comp.identifier} - {comp.title}", + "has_finished_deadlines": comp.get_finished_deadlines().exists(), } context = BaseContext(request, context).context return render(request, template, context) diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py index ecaccbe..ebface8 100644 --- a/compensation/views/eco_account.py +++ b/compensation/views/eco_account.py @@ -242,6 +242,7 @@ def detail_view(request: HttpRequest, id: str): "deductions": deductions, "actions": actions, TAB_TITLE_IDENTIFIER: f"{acc.identifier} - {acc.title}", + "has_finished_deadlines": acc.get_finished_deadlines().exists(), } context = BaseContext(request, context).context return render(request, template, context) diff --git a/ema/templates/ema/detail/includes/deadlines.html b/ema/templates/ema/detail/includes/deadlines.html index 761ce06..0c25b39 100644 --- a/ema/templates/ema/detail/includes/deadlines.html +++ b/ema/templates/ema/detail/includes/deadlines.html @@ -20,6 +20,11 @@ + {% if not has_finished_deadlines %} +
+ {% trans 'Missing finished deadline ' %} +
+ {% endif %}
diff --git a/ema/views.py b/ema/views.py index ce0d68f..589165f 100644 --- a/ema/views.py +++ b/ema/views.py @@ -166,6 +166,7 @@ def detail_view(request: HttpRequest, id: str): "is_ets_member": in_group(_user, ETS_GROUP), "LANIS_LINK": ema.get_LANIS_link(), TAB_TITLE_IDENTIFIER: f"{ema.identifier} - {ema.title}", + "has_finished_deadlines": ema.get_finished_deadlines().exists(), } context = BaseContext(request, context).context return render(request, template, context) diff --git a/konova/tests/test_views.py b/konova/tests/test_views.py index 4037c6b..c600619 100644 --- a/konova/tests/test_views.py +++ b/konova/tests/test_views.py @@ -22,7 +22,7 @@ from codelist.models import KonovaCode, KonovaCodeList from compensation.models import Compensation, CompensationState, CompensationAction, EcoAccount, EcoAccountDeduction from intervention.models import Legal, Responsibility, Intervention, Handler from konova.management.commands.setup_data import GROUPS_DATA -from konova.models import Geometry +from konova.models import Geometry, Deadline, DeadlineType from konova.settings import DEFAULT_GROUP from konova.utils.generators import generate_random_string from user.models import UserActionLogEntry @@ -41,6 +41,7 @@ class BaseTestCase(TestCase): eco_account = None comp_state = None comp_action = None + finished_deadline = None codes = None superuser_pw = "root" @@ -69,6 +70,7 @@ class BaseTestCase(TestCase): self.create_dummy_action() self.codes = self.create_dummy_codes() self.team = self.create_dummy_team() + self.finished_deadline = self.create_dummy_deadline() # Set the default group as only group for the user default_group = self.groups.get(name=DEFAULT_GROUP) @@ -279,6 +281,20 @@ class BaseTestCase(TestCase): return team + def create_dummy_deadline(self, type: DeadlineType = DeadlineType.FINISHED): + """ Creates a dummy deadline. + + If type is not specified, it defaults to DeadlineType.FINISHED + + Returns: + deadline (Deadline): A deadline + """ + deadline = Deadline.objects.create( + type=type, + date="1970-01-01" + ) + return deadline + @staticmethod def create_dummy_geometry() -> MultiPolygon: """ Creates some geometry @@ -361,6 +377,7 @@ class BaseTestCase(TestCase): compensation.before_states.add(self.comp_state) compensation.actions.add(self.comp_action) compensation.geometry.geom = self.create_dummy_geometry() + compensation.deadlines.add(self.finished_deadline) compensation.geometry.save() return compensation @@ -390,6 +407,7 @@ class BaseTestCase(TestCase): ema.before_states.add(self.comp_state) ema.actions.add(self.comp_action) ema.geometry.geom = self.create_dummy_geometry() + ema.deadlines.add(self.finished_deadline) ema.geometry.save() return ema @@ -410,6 +428,7 @@ class BaseTestCase(TestCase): eco_account.geometry.geom = self.create_dummy_geometry() eco_account.geometry.save() eco_account.deductable_surface = eco_account.get_state_after_surface_sum() + eco_account.deadlines.add(self.finished_deadline) eco_account.save() return eco_account diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 7072e4c2765d9290ef6c1c9cd3971d3b72a6cf1e..5b2d55a9dbb4a98c46dd7d7eb3f0612c61cd9508 100644 GIT binary patch delta 12151 zcmZYF33yFczsK>N*^mekkw`)aA`yup2r;DQd7fjQDu^khC=RNI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 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-27 14:23+0200\n" +"POT-Creation-Date: 2022-08-08 14:39+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,7 +55,7 @@ msgstr "Einträge erstellt bis..." #: analysis/forms.py:49 compensation/forms/forms.py:77 #: compensation/templates/compensation/detail/eco_account/view.html:59 #: compensation/templates/compensation/report/eco_account/report.html:16 -#: compensation/utils/quality.py:100 ema/templates/ema/detail/view.html:49 +#: compensation/utils/quality.py:113 ema/templates/ema/detail/view.html:49 #: ema/templates/ema/report/report.html:16 ema/utils/quality.py:26 #: intervention/forms/forms.py:102 #: intervention/templates/intervention/detail/view.html:56 @@ -296,7 +296,7 @@ msgid "Law" msgstr "Gesetz" #: analysis/templates/analysis/reports/includes/old_data/amount.html:17 -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:28 +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:33 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:28 #: ema/templates/ema/detail/includes/deadlines.html:28 msgid "Type" @@ -375,7 +375,7 @@ msgstr "Kompensation XY; Flur ABC" #: compensation/forms/forms.py:57 compensation/forms/modalForms.py:63 #: compensation/forms/modalForms.py:361 compensation/forms/modalForms.py:469 #: compensation/templates/compensation/detail/compensation/includes/actions.html:35 -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:34 +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:39 #: compensation/templates/compensation/detail/compensation/includes/documents.html:34 #: compensation/templates/compensation/detail/eco_account/includes/actions.html:34 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:34 @@ -399,7 +399,7 @@ msgstr "Zusätzlicher Kommentar" #: compensation/forms/forms.py:93 #: compensation/templates/compensation/detail/eco_account/view.html:63 #: compensation/templates/compensation/report/eco_account/report.html:20 -#: compensation/utils/quality.py:102 ema/templates/ema/detail/view.html:53 +#: compensation/utils/quality.py:115 ema/templates/ema/detail/view.html:53 #: ema/templates/ema/report/report.html:20 ema/utils/quality.py:28 #: intervention/forms/forms.py:130 #: intervention/templates/intervention/detail/view.html:60 @@ -485,7 +485,7 @@ msgstr "Neue Kompensation" msgid "Edit compensation" msgstr "Bearbeite Kompensation" -#: compensation/forms/forms.py:356 compensation/utils/quality.py:84 +#: compensation/forms/forms.py:356 compensation/utils/quality.py:97 msgid "Available Surface" msgstr "Verfügbare Fläche" @@ -495,7 +495,7 @@ msgstr "Die für Abbuchungen zur Verfügung stehende Menge" #: compensation/forms/forms.py:368 #: compensation/templates/compensation/detail/eco_account/view.html:67 -#: compensation/utils/quality.py:72 +#: compensation/utils/quality.py:85 msgid "Agreement date" msgstr "Vereinbarungsdatum" @@ -597,7 +597,7 @@ msgid "Select the deadline type" msgstr "Fristart wählen" #: compensation/forms/modalForms.py:345 -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:31 +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:36 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:31 #: ema/templates/ema/detail/includes/deadlines.html:31 #: intervention/forms/modalForms.py:149 @@ -617,7 +617,7 @@ msgid "Insert data for the new deadline" msgstr "Geben Sie die Daten der neuen Frist ein" #: compensation/forms/modalForms.py:389 -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:59 +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:64 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:57 #: ema/templates/ema/detail/includes/deadlines.html:57 msgid "Edit deadline" @@ -798,7 +798,7 @@ msgid "Amount" msgstr "Menge" #: compensation/templates/compensation/detail/compensation/includes/actions.html:40 -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:39 +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:44 #: compensation/templates/compensation/detail/compensation/includes/documents.html:39 #: compensation/templates/compensation/detail/compensation/includes/states-after.html:41 #: compensation/templates/compensation/detail/compensation/includes/states-before.html:41 @@ -882,7 +882,11 @@ msgstr "Termine und Fristen" msgid "Add new deadline" msgstr "Frist/Termin hinzufügen" -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:62 +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:25 +msgid "Missing finished deadline " +msgstr "Umsetzungstermin fehlt" + +#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:67 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:60 #: ema/templates/ema/detail/includes/deadlines.html:60 msgid "Remove deadline" @@ -928,7 +932,7 @@ msgstr "Dokument löschen" #: compensation/templates/compensation/detail/compensation/includes/states-after.html:8 #: compensation/templates/compensation/detail/eco_account/includes/states-after.html:8 -#: compensation/utils/quality.py:39 +#: compensation/utils/quality.py:42 #: ema/templates/ema/detail/includes/states-after.html:8 msgid "States after" msgstr "Zielzustand" @@ -974,7 +978,7 @@ msgstr "Zustand entfernen" #: compensation/templates/compensation/detail/compensation/includes/states-before.html:8 #: compensation/templates/compensation/detail/eco_account/includes/states-before.html:8 -#: compensation/utils/quality.py:37 +#: compensation/utils/quality.py:40 #: ema/templates/ema/detail/includes/states-before.html:8 msgid "States before" msgstr "Ausgangszustand" @@ -1067,6 +1071,24 @@ msgstr "Zuletzt bearbeitet" msgid "Shared with" msgstr "Freigegeben für" +#: compensation/templates/compensation/detail/compensation/view.html:132 +#: compensation/templates/compensation/detail/eco_account/view.html:110 +#: ema/templates/ema/detail/view.html:96 +#: intervention/templates/intervention/detail/view.html:138 +msgid "" +"The data must be shared with you, if you want to see which other users have " +"shared access as well." +msgstr "" +"Die Daten müssen für Sie freigegeben sein, damit Sie sehen können welche " +"weiteren Nutzern ebenfalls Zugriff hierauf haben." + +#: compensation/templates/compensation/detail/compensation/view.html:134 +#: compensation/templates/compensation/detail/eco_account/view.html:112 +#: ema/templates/ema/detail/view.html:98 +#: intervention/templates/intervention/detail/view.html:140 +msgid "other users" +msgstr "weitere Nutzer" + #: compensation/templates/compensation/detail/eco_account/includes/controls.html:15 #: ema/templates/ema/detail/includes/controls.html:15 #: intervention/forms/modalForms.py:71 @@ -1166,21 +1188,25 @@ msgstr "Abbuchungen für" msgid "None" msgstr "-" -#: compensation/utils/quality.py:34 +#: compensation/utils/quality.py:37 msgid "States unequal" msgstr "Ungleiche Zustandsflächenmengen" -#: compensation/utils/quality.py:74 intervention/utils/quality.py:84 +#: compensation/utils/quality.py:61 +msgid "Finished deadlines" +msgstr "Umsetzungstermin" + +#: compensation/utils/quality.py:87 intervention/utils/quality.py:84 msgid "Legal data" msgstr "Rechtliche Daten" -#: compensation/utils/quality.py:88 +#: compensation/utils/quality.py:101 msgid "Deductable surface can not be larger than state surface" msgstr "" "Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht " "überschreiten" -#: compensation/utils/quality.py:104 ema/utils/quality.py:30 +#: compensation/utils/quality.py:117 ema/utils/quality.py:30 #: intervention/utils/quality.py:55 msgid "Responsible data" msgstr "Daten zu den verantwortlichen Stellen" @@ -1198,12 +1224,12 @@ msgstr "Kompensation {} bearbeitet" msgid "Edit {}" msgstr "Bearbeite {}" -#: compensation/views/compensation.py:268 compensation/views/eco_account.py:359 +#: compensation/views/compensation.py:269 compensation/views/eco_account.py:359 #: ema/views.py:194 intervention/views.py:542 msgid "Log" msgstr "Log" -#: compensation/views/compensation.py:612 compensation/views/eco_account.py:727 +#: compensation/views/compensation.py:613 compensation/views/eco_account.py:727 #: ema/views.py:558 intervention/views.py:688 msgid "Report {}" msgstr "Bericht {}" @@ -1549,18 +1575,6 @@ msgstr "Eingriffsverursacher" msgid "Exists" msgstr "vorhanden" -#: intervention/templates/intervention/detail/view.html:138 -msgid "" -"The data must be shared with you, if you want to see which other users have " -"shared access as well." -msgstr "" -"Die Daten müssen für Sie freigegeben sein, damit Sie sehen können welche weiteren Nutzern " -"ebenfalls Zugriff hierauf haben." - -#: intervention/templates/intervention/detail/view.html:140 -msgid "other users" -msgstr "weitere Nutzer" - #: intervention/templates/intervention/report/report.html:58 msgid "Deductions of eco-accounts" msgstr "Abbuchungen von Ökokonten" @@ -2753,7 +2767,7 @@ msgstr "Benachrichtigungen" msgid "Manage teams" msgstr "" -#: user/templates/user/index.html:61 user/templates/user/team/index.html:18 +#: user/templates/user/index.html:61 user/templates/user/team/index.html:19 #: user/views.py:167 msgid "Teams" msgstr "" -- 2.38.5 From 4138481a1b2276696b378a4af424e20c4baf7f62 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 10 Aug 2022 08:03:18 +0200 Subject: [PATCH 2/9] New Notification * adds new notification setting to user settings form * adds translations * adds initial creating of ENUM on setup command --- konova/management/commands/setup_data.py | 3 +- locale/de/LC_MESSAGES/django.mo | Bin 44074 -> 44182 bytes locale/de/LC_MESSAGES/django.po | 82 ++++++++++++----------- user/enums.py | 3 +- user/forms.py | 2 +- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/konova/management/commands/setup_data.py b/konova/management/commands/setup_data.py index 4a5683c..078b547 100644 --- a/konova/management/commands/setup_data.py +++ b/konova/management/commands/setup_data.py @@ -28,4 +28,5 @@ USER_NOTIFICATIONS_NAMES = { "NOTIFY_ON_SHARED_DATA_RECORDED": _("On shared data recorded"), "NOTIFY_ON_SHARED_DATA_DELETED": _("On shared data deleted"), "NOTIFY_ON_SHARED_DATA_CHECKED": _("On shared data checked"), -} \ No newline at end of file + "NOTIFY_ON_DEDUCTION_CHANGES": _("On deduction changes"), +} diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 5b2d55a9dbb4a98c46dd7d7eb3f0612c61cd9508..d1cbdfba463cad7b0e3308a74702bbfb3158c120 100644 GIT binary patch delta 11374 zcmY+~2YgT0|Htv0L`Z^=AdyBSL`1}l8Czv@zVjhlj5#7YURCk=B#8YZGP9E{xnvT;0`@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E5QDlQ z&gPR*Gmwtj&CP6iSJZVqQ1#{6@<&ni4Z#2$fx2(pCgxua%%(s$6r$E}5o*`3!8H5~ z>)}0YiYc4Hmqg00mc7j-sYj4yGO2-V+B=S|YM>u{V>1C*68s&pX-+A}PMGjp<^zY*u`6;AV zN#FnbgpDUseuH$Kd_1-P2fLEjaTp&V@hR+VBYk1ZFMA(|k8ItNTwfCJQKvF@K4{PW zO1_1Sza`EiEdLr9_I_0!zjq-Os&AoIK2I`8g;82_7`dc%7@A*SgjqF_4X zhk@w91tcBUaU6bEnlt~Lr|b{H&%7CRV%+EKl_l0roH;_8N#1MAbl*ne&#@}$PvZCO zxgW`&CRL>6jDKCP=VqJDKZdJG7j3>T=Qfzwd$P{J=&{60?YW;hHCfOlhnfO!E*Q6?>StK1@tb7r5niA{NOvg{eSIn%K0*|+sCpjq7UOs}tbKZrX zpPOy@e95{$|r?-gOb9B>Vr)$ z%=)BLly)Fhp)45tP?knoMf}gPn4q7{$K$g$u8rMD`oAgaNWpS=pR$$Sc}Wf3FNwlP z7S#BV2{mDu#L-;)5pg+t&q~U2$S*P#I-e6iM_iF~i}+nqXYab? z7@s@d{mJ1$JIJrL*S_SvlAP@>p@dJq|97;f>>W}RDVp>FNyj(V5aM*=g*IQw_U2IO zRpw{5CpmYAd=q<(P9@sw=1{hd`~V-e-5P?oNj2=rNaEup9l759DT%phocWkrc2hDO zFP5I;Q=0fF@sp%CNn6O5<=WqfpC)x6)u(Jc={@3fl8(Q;O;cms>6F&u>c#josV3FhV(wE3=Qefcgp3IU-foQi;H-k=o!*6 z(niii;=`EjotGAw@jbb@klNA5} diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 1da188a..893d438 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-08 14:39+0200\n" +"POT-Creation-Date: 2022-08-10 08:01+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,7 +55,7 @@ msgstr "Einträge erstellt bis..." #: analysis/forms.py:49 compensation/forms/forms.py:77 #: compensation/templates/compensation/detail/eco_account/view.html:59 #: compensation/templates/compensation/report/eco_account/report.html:16 -#: compensation/utils/quality.py:113 ema/templates/ema/detail/view.html:49 +#: compensation/utils/quality.py:111 ema/templates/ema/detail/view.html:49 #: ema/templates/ema/report/report.html:16 ema/utils/quality.py:26 #: intervention/forms/forms.py:102 #: intervention/templates/intervention/detail/view.html:56 @@ -297,8 +297,8 @@ msgstr "Gesetz" #: analysis/templates/analysis/reports/includes/old_data/amount.html:17 #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:33 -#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:28 -#: ema/templates/ema/detail/includes/deadlines.html:28 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:33 +#: ema/templates/ema/detail/includes/deadlines.html:33 msgid "Type" msgstr "Typ" @@ -378,10 +378,10 @@ msgstr "Kompensation XY; Flur ABC" #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:39 #: compensation/templates/compensation/detail/compensation/includes/documents.html:34 #: compensation/templates/compensation/detail/eco_account/includes/actions.html:34 -#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:34 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:39 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:34 #: ema/templates/ema/detail/includes/actions.html:34 -#: ema/templates/ema/detail/includes/deadlines.html:34 +#: ema/templates/ema/detail/includes/deadlines.html:39 #: ema/templates/ema/detail/includes/documents.html:34 #: intervention/forms/forms.py:198 intervention/forms/modalForms.py:175 #: intervention/templates/intervention/detail/includes/documents.html:34 @@ -399,7 +399,7 @@ msgstr "Zusätzlicher Kommentar" #: compensation/forms/forms.py:93 #: compensation/templates/compensation/detail/eco_account/view.html:63 #: compensation/templates/compensation/report/eco_account/report.html:20 -#: compensation/utils/quality.py:115 ema/templates/ema/detail/view.html:53 +#: compensation/utils/quality.py:113 ema/templates/ema/detail/view.html:53 #: ema/templates/ema/report/report.html:20 ema/utils/quality.py:28 #: intervention/forms/forms.py:130 #: intervention/templates/intervention/detail/view.html:60 @@ -485,7 +485,7 @@ msgstr "Neue Kompensation" msgid "Edit compensation" msgstr "Bearbeite Kompensation" -#: compensation/forms/forms.py:356 compensation/utils/quality.py:97 +#: compensation/forms/forms.py:356 compensation/utils/quality.py:95 msgid "Available Surface" msgstr "Verfügbare Fläche" @@ -495,7 +495,7 @@ msgstr "Die für Abbuchungen zur Verfügung stehende Menge" #: compensation/forms/forms.py:368 #: compensation/templates/compensation/detail/eco_account/view.html:67 -#: compensation/utils/quality.py:85 +#: compensation/utils/quality.py:83 msgid "Agreement date" msgstr "Vereinbarungsdatum" @@ -598,8 +598,8 @@ msgstr "Fristart wählen" #: compensation/forms/modalForms.py:345 #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:36 -#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:31 -#: ema/templates/ema/detail/includes/deadlines.html:31 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:36 +#: ema/templates/ema/detail/includes/deadlines.html:36 #: intervention/forms/modalForms.py:149 msgid "Date" msgstr "Datum" @@ -618,8 +618,8 @@ msgstr "Geben Sie die Daten der neuen Frist ein" #: compensation/forms/modalForms.py:389 #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:64 -#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:57 -#: ema/templates/ema/detail/includes/deadlines.html:57 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:62 +#: ema/templates/ema/detail/includes/deadlines.html:62 msgid "Edit deadline" msgstr "Frist/Termin bearbeiten" @@ -803,13 +803,13 @@ msgstr "Menge" #: compensation/templates/compensation/detail/compensation/includes/states-after.html:41 #: compensation/templates/compensation/detail/compensation/includes/states-before.html:41 #: compensation/templates/compensation/detail/eco_account/includes/actions.html:39 -#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:38 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:43 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:41 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:38 #: compensation/templates/compensation/detail/eco_account/includes/states-after.html:41 #: compensation/templates/compensation/detail/eco_account/includes/states-before.html:41 #: ema/templates/ema/detail/includes/actions.html:38 -#: ema/templates/ema/detail/includes/deadlines.html:38 +#: ema/templates/ema/detail/includes/deadlines.html:43 #: ema/templates/ema/detail/includes/documents.html:38 #: ema/templates/ema/detail/includes/states-after.html:40 #: ema/templates/ema/detail/includes/states-before.html:40 @@ -883,12 +883,14 @@ msgid "Add new deadline" msgstr "Frist/Termin hinzufügen" #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:25 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:25 +#: ema/templates/ema/detail/includes/deadlines.html:25 msgid "Missing finished deadline " msgstr "Umsetzungstermin fehlt" #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:67 -#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:60 -#: ema/templates/ema/detail/includes/deadlines.html:60 +#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:65 +#: ema/templates/ema/detail/includes/deadlines.html:65 msgid "Remove deadline" msgstr "Frist löschen" @@ -932,7 +934,7 @@ msgstr "Dokument löschen" #: compensation/templates/compensation/detail/compensation/includes/states-after.html:8 #: compensation/templates/compensation/detail/eco_account/includes/states-after.html:8 -#: compensation/utils/quality.py:42 +#: compensation/utils/quality.py:40 #: ema/templates/ema/detail/includes/states-after.html:8 msgid "States after" msgstr "Zielzustand" @@ -978,7 +980,7 @@ msgstr "Zustand entfernen" #: compensation/templates/compensation/detail/compensation/includes/states-before.html:8 #: compensation/templates/compensation/detail/eco_account/includes/states-before.html:8 -#: compensation/utils/quality.py:40 +#: compensation/utils/quality.py:38 #: ema/templates/ema/detail/includes/states-before.html:8 msgid "States before" msgstr "Ausgangszustand" @@ -1188,25 +1190,25 @@ msgstr "Abbuchungen für" msgid "None" msgstr "-" -#: compensation/utils/quality.py:37 +#: compensation/utils/quality.py:35 msgid "States unequal" msgstr "Ungleiche Zustandsflächenmengen" -#: compensation/utils/quality.py:61 +#: compensation/utils/quality.py:59 msgid "Finished deadlines" msgstr "Umsetzungstermin" -#: compensation/utils/quality.py:87 intervention/utils/quality.py:84 +#: compensation/utils/quality.py:85 intervention/utils/quality.py:84 msgid "Legal data" msgstr "Rechtliche Daten" -#: compensation/utils/quality.py:101 +#: compensation/utils/quality.py:99 msgid "Deductable surface can not be larger than state surface" msgstr "" "Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht " "überschreiten" -#: compensation/utils/quality.py:117 ema/utils/quality.py:30 +#: compensation/utils/quality.py:115 ema/utils/quality.py:30 #: intervention/utils/quality.py:55 msgid "Responsible data" msgstr "Daten zu den verantwortlichen Stellen" @@ -1220,17 +1222,17 @@ msgid "Compensation {} edited" msgstr "Kompensation {} bearbeitet" #: compensation/views/compensation.py:182 compensation/views/eco_account.py:173 -#: ema/views.py:240 intervention/views.py:338 +#: ema/views.py:241 intervention/views.py:338 msgid "Edit {}" msgstr "Bearbeite {}" -#: compensation/views/compensation.py:269 compensation/views/eco_account.py:359 -#: ema/views.py:194 intervention/views.py:542 +#: compensation/views/compensation.py:269 compensation/views/eco_account.py:360 +#: ema/views.py:195 intervention/views.py:542 msgid "Log" msgstr "Log" -#: compensation/views/compensation.py:613 compensation/views/eco_account.py:727 -#: ema/views.py:558 intervention/views.py:688 +#: compensation/views/compensation.py:613 compensation/views/eco_account.py:728 +#: ema/views.py:559 intervention/views.py:688 msgid "Report {}" msgstr "Bericht {}" @@ -1246,36 +1248,36 @@ msgstr "Ökokonto {} hinzugefügt" msgid "Eco-Account {} edited" msgstr "Ökokonto {} bearbeitet" -#: compensation/views/eco_account.py:276 +#: compensation/views/eco_account.py:277 msgid "Eco-account removed" msgstr "Ökokonto entfernt" -#: compensation/views/eco_account.py:380 ema/views.py:282 +#: compensation/views/eco_account.py:381 ema/views.py:283 #: intervention/views.py:641 msgid "{} unrecorded" msgstr "{} entzeichnet" -#: compensation/views/eco_account.py:380 ema/views.py:282 +#: compensation/views/eco_account.py:381 ema/views.py:283 #: intervention/views.py:641 msgid "{} recorded" msgstr "{} verzeichnet" -#: compensation/views/eco_account.py:804 ema/views.py:628 +#: compensation/views/eco_account.py:805 ema/views.py:629 #: intervention/views.py:439 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: compensation/views/eco_account.py:809 ema/views.py:633 +#: compensation/views/eco_account.py:810 ema/views.py:634 #: intervention/views.py:444 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: compensation/views/eco_account.py:816 ema/views.py:640 +#: compensation/views/eco_account.py:817 ema/views.py:641 #: intervention/views.py:451 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: compensation/views/eco_account.py:839 ema/views.py:663 +#: compensation/views/eco_account.py:840 ema/views.py:664 #: intervention/views.py:474 msgid "Share settings updated" msgstr "Freigabe Einstellungen aktualisiert" @@ -1316,11 +1318,11 @@ msgstr "EMAs - Übersicht" msgid "EMA {} added" msgstr "EMA {} hinzugefügt" -#: ema/views.py:230 +#: ema/views.py:231 msgid "EMA {} edited" msgstr "EMA {} bearbeitet" -#: ema/views.py:263 +#: ema/views.py:264 msgid "EMA removed" msgstr "EMA entfernt" @@ -1799,6 +1801,10 @@ msgstr "Wenn meine freigegebenen Daten gelöscht wurden" msgid "On shared data checked" msgstr "Wenn meine freigegebenen Daten geprüft wurden" +#: konova/management/commands/setup_data.py:31 +msgid "On deduction changes" +msgstr "Wenn eine Abbuchung zu meinem Ökokonto verändert oder gelöscht wird" + #: konova/models/deadline.py:18 msgid "Finished" msgstr "Umgesetzt bis" diff --git a/user/enums.py b/user/enums.py index 8d0c34d..04f27b7 100644 --- a/user/enums.py +++ b/user/enums.py @@ -13,4 +13,5 @@ class UserNotificationEnum(BaseEnum): NOTIFY_ON_SHARED_DATA_RECORDED = "NOTIFY_ON_SHARED_DATA_RECORDED" # notifies in case data has been "verzeichnet" NOTIFY_ON_SHARED_DATA_DELETED = "NOTIFY_ON_SHARED_DATA_DELETED" # notifies in case data has been deleted NOTIFY_ON_SHARED_DATA_CHECKED = "NOTIFY_ON_SHARED_DATA_CHECKED" # notifies in case shared data has been checked - NOTIFY_ON_SHARED_ACCESS_GAINED = "NOTIFY_ON_SHARED_ACCESS_GAINED" # notifies in case new access has been gained \ No newline at end of file + NOTIFY_ON_SHARED_ACCESS_GAINED = "NOTIFY_ON_SHARED_ACCESS_GAINED" # notifies in case new access has been gained + NOTIFY_ON_DEDUCTION_CHANGES = "NOTIFY_ON_DEDUCTION_CHANGES" # notifies in case any changes (edit|remove) have been performed on a deduction of the user's ecoaccounts \ No newline at end of file diff --git a/user/forms.py b/user/forms.py index a92c6b0..12688b4 100644 --- a/user/forms.py +++ b/user/forms.py @@ -7,7 +7,7 @@ Created on: 08.07.21 """ from dal import autocomplete from django import forms -from django.db import IntegrityError, transaction +from django.db import transaction from django.urls import reverse, reverse_lazy from django.utils.translation import gettext_lazy as _ -- 2.38.5 From ff26019b6efddaf4a90455467a14c83fb25994b5 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 10 Aug 2022 08:59:24 +0200 Subject: [PATCH 3/9] Mail sending * adds mail sending logic for new notification setting * adds new templates for user and team based sending * enhances all email template layout * adds translations --- compensation/models/eco_account.py | 22 ++++++- intervention/forms/modalForms.py | 34 ++++++++--- konova/tasks.py | 14 +++++ konova/utils/mailer.py | 55 ++++++++++++++++++ locale/de/LC_MESSAGES/django.mo | Bin 44182 -> 44532 bytes locale/de/LC_MESSAGES/django.po | 54 +++++++++++++---- templates/email/api/verify_token.html | 1 + .../email/checking/shared_data_checked.html | 1 + .../checking/shared_data_checked_team.html | 1 + .../email/deleting/shared_data_deleted.html | 1 + .../deleting/shared_data_deleted_team.html | 1 + templates/email/other/deduction_changed.html | 50 ++++++++++++++++ .../email/other/deduction_changed_team.html | 50 ++++++++++++++++ .../email/recording/shared_data_recorded.html | 1 + .../recording/shared_data_recorded_team.html | 1 + .../recording/shared_data_unrecorded.html | 1 + .../shared_data_unrecorded_team.html | 1 + .../email/sharing/shared_access_given.html | 1 + .../sharing/shared_access_given_team.html | 1 + .../email/sharing/shared_access_removed.html | 1 + .../sharing/shared_access_removed_team.html | 1 + user/models/team.py | 14 +++++ user/models/user.py | 16 +++++ 23 files changed, 300 insertions(+), 22 deletions(-) create mode 100644 templates/email/other/deduction_changed.html create mode 100644 templates/email/other/deduction_changed_team.html diff --git a/compensation/models/eco_account.py b/compensation/models/eco_account.py index 3d48b69..42a202f 100644 --- a/compensation/models/eco_account.py +++ b/compensation/models/eco_account.py @@ -21,6 +21,7 @@ from compensation.models.compensation import AbstractCompensation, PikMixin from compensation.utils.quality import EcoAccountQualityChecker from konova.models import ShareableObjectMixin, RecordableObjectMixin, AbstractDocument, BaseResource, \ generate_document_file_upload_path +from konova.tasks import celery_send_mail_deduction_changed, celery_send_mail_deduction_changed_team class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin, PikMixin): @@ -161,6 +162,25 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix """ return reverse("compensation:acc:share", args=(self.id, self.access_token)) + def send_notification_mail_on_deduction_change(self, data_change: dict): + """ Sends notification mails for changes on the deduction + + Args: + data_change (): + + Returns: + + """ + # Send mail + shared_users = self.shared_users.values_list("id", flat=True) + for user_id in shared_users: + celery_send_mail_deduction_changed.delay(self.identifier, self.title, user_id, data_change) + + # Send mail + shared_teams = self.shared_teams.values_list("id", flat=True) + for team_id in shared_teams: + celery_send_mail_deduction_changed_team.delay(self.identifier, self.title, team_id, data_change) + class EcoAccountDocument(AbstractDocument): """ @@ -251,4 +271,4 @@ class EcoAccountDeduction(BaseResource): if user is not None: self.intervention.mark_as_edited(user, edit_comment=DEDUCTION_REMOVED) self.account.mark_as_edited(user, edit_comment=DEDUCTION_REMOVED) - super().delete(*args, **kwargs) \ No newline at end of file + super().delete(*args, **kwargs) diff --git a/intervention/forms/modalForms.py b/intervention/forms/modalForms.py index 07911be..b6445a5 100644 --- a/intervention/forms/modalForms.py +++ b/intervention/forms/modalForms.py @@ -508,28 +508,44 @@ class EditEcoAccountDeductionModalForm(NewDeductionModalForm): deduction = self.deduction form_account = self.cleaned_data.get("account", None) form_intervention = self.cleaned_data.get("intervention", None) - current_account = deduction.account - current_intervention = deduction.intervention - + old_account = deduction.account + old_intervention = deduction.intervention + old_surface = deduction.surface # If account or intervention has been changed, we put that change in the logs just as if the deduction has # been removed for this entry. Act as if the deduction is newly created for the new entries - if current_account != form_account: - current_account.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_REMOVED) + if old_account != form_account: + old_account.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_REMOVED) form_account.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_ADDED) else: - current_account.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_EDITED) + old_account.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_EDITED) - if current_intervention != form_intervention: - current_intervention.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_REMOVED) + if old_intervention != form_intervention: + old_intervention.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_REMOVED) form_intervention.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_ADDED) else: - current_intervention.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_EDITED) + old_intervention.mark_as_edited(self.user, self.request, edit_comment=DEDUCTION_EDITED) deduction.account = form_account deduction.intervention = self.cleaned_data.get("intervention", None) deduction.surface = self.cleaned_data.get("surface", None) deduction.save() + + data_changes = { + "surface": { + "old": old_surface, + "new": deduction.surface, + }, + "intervention": { + "old": old_intervention.identifier, + "new": deduction.intervention.identifier, + }, + "account": { + "old": old_account.identifier, + "new": deduction.account.identifier, + } + } + old_account.send_notification_mail_on_deduction_change(data_changes) return deduction diff --git a/konova/tasks.py b/konova/tasks.py index 798effb..6580121 100644 --- a/konova/tasks.py +++ b/konova/tasks.py @@ -106,3 +106,17 @@ def celery_send_mail_shared_data_checked_team(obj_identifier, obj_title=None, te from user.models import Team team = Team.objects.get(id=team_id) team.send_mail_shared_data_checked(obj_identifier, obj_title) + + +@shared_task +def celery_send_mail_deduction_changed_team(obj_identifier, obj_title=None, team_id=None, data_changes=None): + from user.models import Team + team = Team.objects.get(id=team_id) + team.send_mail_deduction_changed(obj_identifier, obj_title, data_changes) + + +@shared_task +def celery_send_mail_deduction_changed(obj_identifier, obj_title=None, user_id=None, data_changes=None): + from user.models import User + user = User.objects.get(id=user_id) + user.send_mail_deduction_changed(obj_identifier, obj_title, data_changes) diff --git a/konova/utils/mailer.py b/konova/utils/mailer.py index dd8eef1..92bd2b6 100644 --- a/konova/utils/mailer.py +++ b/konova/utils/mailer.py @@ -207,6 +207,33 @@ class Mailer: msg ) + def send_mail_deduction_changed_team(self, obj_identifier, obj_title, team, data_changes): + """ Send a mail if deduction has been changed + + Args: + obj_identifier (str): Identifier of the main object + obj_title (str): Title of the main object + team (Team): Team to be notified + data_changes (dict): Contains the old|new changes of the deduction changes + + Returns: + + """ + context = { + "team": team, + "obj_identifier": obj_identifier, + "obj_title": obj_title, + "EMAIL_REPLY_TO": EMAIL_REPLY_TO, + "data_changes": data_changes, + } + msg = render_to_string("email/other/deduction_changed_team.html", context) + user_mail_address = team.users.values_list("email", flat=True) + self.send( + user_mail_address, + _("{} - Deduction changed").format(obj_identifier), + msg + ) + def send_mail_shared_data_deleted_team(self, obj_identifier, obj_title, team): """ Send a mail if data has just been deleted @@ -322,6 +349,34 @@ class Mailer: msg ) + def send_mail_deduction_changed(self, obj_identifier, obj_title, user, data_changes): + """ Send a mail if deduction has been changed + + Args: + obj_identifier (str): Identifier of the main object + obj_title (str): Title of the main object + user (User): User to be notified + data_changes (dict): Contains the old|new changes of the deduction changes + + + Returns: + + """ + context = { + "user": user, + "obj_identifier": obj_identifier, + "obj_title": obj_title, + "EMAIL_REPLY_TO": EMAIL_REPLY_TO, + "data_changes": data_changes, + } + msg = render_to_string("email/other/deduction_changed.html", context) + user_mail_address = [user.email] + self.send( + user_mail_address, + _("{} - Deduction changed").format(obj_identifier), + msg + ) + def send_mail_verify_api_token(self, user): """ Send a mail if a user creates a new token diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index d1cbdfba463cad7b0e3308a74702bbfb3158c120..6ee76a29ae6b97210a548c54b5f64f6f34f30f49 100644 GIT binary patch delta 12475 zcmZA72YgT0|HttwOAYSWg`)}~5- zwK`~PmDa4%8ZEW@^LxE>PWtcTe;@ti`8ns_d(OG%ocql;9$j$O>(BFE?!^K=^Bs;_ zUXD{7kB2zU1M+cEs&$-pRU9XOF2`w)nUwofb)3AEAK=%Ny{kJ;7d(wASg{7z;$lp| z+c+8P)pVQ)Jb<x9KR&NM1YVFBETd2z2TA45OgfO+tmt-psf;P}wmC=5Z} zHy!ig0_z&oecMsbbimeM#ZdZp{vZkFgnw-s!6K+~Ma+-&u^_g=P)tO1oPp|S5*EU_ z*7aC~@_r1*v#9ItTXWSh4;qYR=--JViNRK=Cmn;jVFG&N9Ax&LOnd$iZlHV=HL&!$ zW%(bpJ;mr*nD2sQBh_07zb#c;~8sD2XaGym$K3l&=PWK_eWuqe*NNL+*J z=rHQWE2shAvgJQf_dP=mB=`k0L#0qNQXbWQUDW-pP&3@YB`HqQ6Sa0@QByh{eeh${ zOzgJjPof5V0oCv=RKrhEYaP_U46G2grW}dvJ7);a!quqzsx&kMbsLhXf%dkdFKT4z zsE%CJOw2}&d;@Cjx7zZjs5L!+#qc<4W`02}**#nSFKTIWH!|%;AOmroN+cS2eN@BE zP*eC4YNWkU9i*Zfd<`{I(^2Oapw@aV>ik~Rj2=Y|{03^xy&9XnQw%kbsu-mAzZ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uJf2nRBc`)tN!eZF>rE^Lb>-i%%vD7~7H_DUAgX!%M zJWtG_t{hR7JRhN79#e_A#9Bg!zH*;)?k4dGp<_5v&*tBe7oyEEc*fR|IKH^+ z;KWek}^IH6-3Rw62rFTmnl`vmtBe-S$VGC21rHzMDSM{J$Q z%RRYAm^<_TUv3GP*qmyI-#JbNE*?Mw+lh4I3Uw(&6!rh2j&R#x8_xf2s+>$rqwK-C z_sI*AA0>Vy0*L8^j^2|2;Pkvn`F|gufk4E%L94oWs@y zP#8qrY@z~r3F;4!``Ggr_@PPv?`ITsLnwVk z>?L1{pAsR&6rzmY{{tiwIav?i$Go_g@T6lp@)OIc|CK099*8d==WSs<&ga||;uNuw zawvAeMwok4CGjLW5Fcm`ZgFxJh5q<0>L|v;OPMt1KRkjcM-q3q#>+h`vC2^2tb=jW zyt2ACJnNoSH$FRG)|13@g|nWg^zc|TW1xT5#DNq1v;G@1B2U(|Nwqw)4yMm4kd?H+ RJ0xq)mOtII7H#e0_CI69)-?bC diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 893d438..b4b1861 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-10 08:01+0200\n" +"POT-Creation-Date: 2022-08-10 08:37+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -241,6 +241,7 @@ msgstr "" #: ema/templates/ema/detail/includes/states-after.html:36 #: ema/templates/ema/detail/includes/states-before.html:36 #: intervention/forms/modalForms.py:364 +#: templates/email/other/deduction_changed.html:29 msgid "Surface" msgstr "Fläche" @@ -307,6 +308,7 @@ msgstr "Typ" #: intervention/forms/modalForms.py:382 intervention/tables.py:87 #: intervention/templates/intervention/detail/view.html:19 #: konova/templates/konova/includes/quickstart/interventions.html:4 +#: templates/email/other/deduction_changed.html:24 #: templates/navbars/navbar.html:22 msgid "Intervention" msgstr "Eingriff" @@ -696,14 +698,14 @@ msgstr "" msgid "Pieces" msgstr "Stück" -#: compensation/models/eco_account.py:55 +#: compensation/models/eco_account.py:56 msgid "" "Deductable surface can not be larger than existing surfaces in after states" msgstr "" "Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht " "überschreiten" -#: compensation/models/eco_account.py:62 +#: compensation/models/eco_account.py:63 msgid "" "Deductable surface can not be smaller than the sum of already existing " "deductions. Please contact the responsible users for the deductions!" @@ -1915,23 +1917,27 @@ msgstr "{} - Zugriff entzogen" msgid "{} - Shared access given" msgstr "{} - Zugriff freigegeben" -#: konova/utils/mailer.py:160 konova/utils/mailer.py:275 +#: konova/utils/mailer.py:160 konova/utils/mailer.py:302 msgid "{} - Shared data unrecorded" msgstr "{} - Freigegebene Daten entzeichnet" -#: konova/utils/mailer.py:183 konova/utils/mailer.py:252 +#: konova/utils/mailer.py:183 konova/utils/mailer.py:279 msgid "{} - Shared data recorded" msgstr "{} - Freigegebene Daten verzeichnet" -#: konova/utils/mailer.py:206 konova/utils/mailer.py:321 +#: konova/utils/mailer.py:206 konova/utils/mailer.py:348 msgid "{} - Shared data checked" msgstr "{} - Freigegebene Daten geprüft" -#: konova/utils/mailer.py:229 konova/utils/mailer.py:298 +#: konova/utils/mailer.py:233 konova/utils/mailer.py:372 +msgid "{} - Deduction changed" +msgstr "{} - Abbuchung geändert" + +#: konova/utils/mailer.py:256 konova/utils/mailer.py:325 msgid "{} - Shared data deleted" msgstr "{} - Freigegebene Daten gelöscht" -#: konova/utils/mailer.py:342 templates/email/api/verify_token.html:4 +#: konova/utils/mailer.py:393 templates/email/api/verify_token.html:4 msgid "Request for new API token" msgstr "Anfrage für neuen API Token" @@ -2235,6 +2241,7 @@ msgstr "" #: templates/email/checking/shared_data_checked_team.html:19 #: templates/email/deleting/shared_data_deleted.html:19 #: templates/email/deleting/shared_data_deleted_team.html:19 +#: templates/email/other/deduction_changed.html:38 #: templates/email/recording/shared_data_recorded.html:19 #: templates/email/recording/shared_data_recorded_team.html:19 #: templates/email/recording/shared_data_unrecorded.html:19 @@ -2253,6 +2260,7 @@ msgstr "Freigegebene Daten geprüft" #: templates/email/checking/shared_data_checked.html:8 #: templates/email/deleting/shared_data_deleted.html:8 +#: templates/email/other/deduction_changed.html:8 #: templates/email/recording/shared_data_recorded.html:8 #: templates/email/recording/shared_data_unrecorded.html:8 #: templates/email/sharing/shared_access_given.html:8 @@ -2295,6 +2303,7 @@ msgstr "der folgende Datensatz wurde soeben gelöscht " #: templates/email/deleting/shared_data_deleted.html:16 #: templates/email/deleting/shared_data_deleted_team.html:16 +#: templates/email/other/deduction_changed.html:35 msgid "" "If this should not have been happened, please contact us. See the signature " "for details." @@ -2302,6 +2311,31 @@ msgstr "" "Falls das nicht hätte passieren dürfen, kontaktieren Sie uns bitte. In der E-" "mail Signatur finden Sie weitere Kontaktinformationen." +#: templates/email/other/deduction_changed.html:4 +msgid "Deduction changed" +msgstr "Abbuchung geändert" + +#: templates/email/other/deduction_changed.html:10 +msgid "a deduction of this eco account has changed:" +msgstr "eine Abbuchung des Ökokontos hat sich geändert:" + +#: templates/email/other/deduction_changed.html:14 +msgid "Attribute" +msgstr "Attribute" + +#: templates/email/other/deduction_changed.html:15 +msgid "Old" +msgstr "Alt" + +#: templates/email/other/deduction_changed.html:16 +#: templates/generic_index.html:43 user/templates/user/team/index.html:22 +msgid "New" +msgstr "Neu" + +#: templates/email/other/deduction_changed.html:19 +msgid "EcoAccount" +msgstr "Ökokonto" + #: templates/email/recording/shared_data_recorded.html:4 #: templates/email/recording/shared_data_recorded_team.html:4 msgid "Shared data recorded" @@ -2499,10 +2533,6 @@ msgstr "* sind Pflichtfelder." msgid "New entry" msgstr "Neuer Eintrag" -#: templates/generic_index.html:43 user/templates/user/team/index.html:22 -msgid "New" -msgstr "Neu" - #: templates/generic_index.html:58 msgid "Search for keywords" msgstr "Nach Schlagwörtern suchen" diff --git a/templates/email/api/verify_token.html b/templates/email/api/verify_token.html index bd12a0f..355647b 100644 --- a/templates/email/api/verify_token.html +++ b/templates/email/api/verify_token.html @@ -6,6 +6,7 @@

{% trans 'Hello support' %},
+
{% trans 'you need to verify the API token for user' %}:

diff --git a/templates/email/checking/shared_data_checked.html b/templates/email/checking/shared_data_checked.html index 0b67ecc..133dae2 100644 --- a/templates/email/checking/shared_data_checked.html +++ b/templates/email/checking/shared_data_checked.html @@ -7,6 +7,7 @@
{% trans 'Hello ' %} {{user.username}},
+
{% trans 'the following dataset has just been checked' %}
{{obj_identifier}} diff --git a/templates/email/checking/shared_data_checked_team.html b/templates/email/checking/shared_data_checked_team.html index ee81381..6a7a450 100644 --- a/templates/email/checking/shared_data_checked_team.html +++ b/templates/email/checking/shared_data_checked_team.html @@ -7,6 +7,7 @@
{% trans 'Hello team' %} {{team.name}},
+
{% trans 'the following dataset has just been checked' %}
{{obj_identifier}} diff --git a/templates/email/deleting/shared_data_deleted.html b/templates/email/deleting/shared_data_deleted.html index 272b0fd..7857444 100644 --- a/templates/email/deleting/shared_data_deleted.html +++ b/templates/email/deleting/shared_data_deleted.html @@ -7,6 +7,7 @@
{% trans 'Hello ' %} {{user.username}},
+
{% trans 'the following dataset has just been deleted' %}
{{obj_identifier}} diff --git a/templates/email/deleting/shared_data_deleted_team.html b/templates/email/deleting/shared_data_deleted_team.html index cedb2a4..0ffa8bb 100644 --- a/templates/email/deleting/shared_data_deleted_team.html +++ b/templates/email/deleting/shared_data_deleted_team.html @@ -7,6 +7,7 @@
{% trans 'Hello team' %} {{team.name}},
+
{% trans 'the following dataset has just been deleted' %}
{{obj_identifier}} diff --git a/templates/email/other/deduction_changed.html b/templates/email/other/deduction_changed.html new file mode 100644 index 0000000..8129f6b --- /dev/null +++ b/templates/email/other/deduction_changed.html @@ -0,0 +1,50 @@ +{% load i18n %} + +
+

{% translate 'Deduction changed' %}

+

{{obj_identifier}}

+
+
+ {% translate 'Hello ' %} {{user.username}}, +
+
+ {% translate 'a deduction of this eco account has changed:' %} +
+
+
+ + + + + + + + + + + + + + + + + + + + +
{% translate 'Attribute' %}{% translate 'Old' %}{% translate 'New' %}
{% translate 'EcoAccount' %}{{data_changes.account.old}}{{data_changes.account.new}}
{% translate 'Intervention' %}{{data_changes.intervention.old}}{{data_changes.intervention.new}}
{% translate 'Surface' %}{{data_changes.surface.old}} m²{{data_changes.surface.new}} m²
+
+
+ {% translate 'If this should not have been happened, please contact us. See the signature for details.' %} +
+
+ {% translate 'Best regards' %} +
+ KSP +
+
+
+ {% include 'email/signature.html' %} + +
+ diff --git a/templates/email/other/deduction_changed_team.html b/templates/email/other/deduction_changed_team.html new file mode 100644 index 0000000..babf36c --- /dev/null +++ b/templates/email/other/deduction_changed_team.html @@ -0,0 +1,50 @@ +{% load i18n %} + +
+

{% translate 'Deduction changed' %}

+

{{obj_identifier}}

+
+
+ {% trans 'Hello team' %} {{team.name}}, +
+
+ {% translate 'a deduction of this eco account has changed:' %} +
+
+ + + + + + + + + + + + + + + + + + + + + +
{% translate 'Attribute' %}{% translate 'Old' %}{% translate 'New' %}
{% translate 'EcoAccount' %}{{data_changes.account.old}}{{data_changes.account.new}}
{% translate 'Intervention' %}{{data_changes.intervention.old}}{{data_changes.intervention.new}}
{% translate 'Surface' %}{{data_changes.surface.old}} m²{{data_changes.surface.new}} m²
+
+
+ {% translate 'If this should not have been happened, please contact us. See the signature for details.' %} +
+
+ {% translate 'Best regards' %} +
+ KSP +
+
+
+ {% include 'email/signature.html' %} +
+
+ diff --git a/templates/email/recording/shared_data_recorded.html b/templates/email/recording/shared_data_recorded.html index 6805c92..ccad11e 100644 --- a/templates/email/recording/shared_data_recorded.html +++ b/templates/email/recording/shared_data_recorded.html @@ -7,6 +7,7 @@
{% trans 'Hello ' %} {{user.username}},
+
{% trans 'the following dataset has just been recorded' %}
{{obj_identifier}} diff --git a/templates/email/recording/shared_data_recorded_team.html b/templates/email/recording/shared_data_recorded_team.html index 12efa8f..0734bc6 100644 --- a/templates/email/recording/shared_data_recorded_team.html +++ b/templates/email/recording/shared_data_recorded_team.html @@ -7,6 +7,7 @@
{% trans 'Hello team' %} {{team.name}},
+
{% trans 'the following dataset has just been recorded' %}
{{obj_identifier}} diff --git a/templates/email/recording/shared_data_unrecorded.html b/templates/email/recording/shared_data_unrecorded.html index 1e0310a..3406b75 100644 --- a/templates/email/recording/shared_data_unrecorded.html +++ b/templates/email/recording/shared_data_unrecorded.html @@ -7,6 +7,7 @@
{% trans 'Hello ' %} {{user.username}},
+
{% trans 'the following dataset has just been unrecorded' %}
{{obj_identifier}} diff --git a/templates/email/recording/shared_data_unrecorded_team.html b/templates/email/recording/shared_data_unrecorded_team.html index 6414155..5c0f856 100644 --- a/templates/email/recording/shared_data_unrecorded_team.html +++ b/templates/email/recording/shared_data_unrecorded_team.html @@ -7,6 +7,7 @@
{% trans 'Hello team' %} {{team.name}},
+
{% trans 'the following dataset has just been unrecorded' %}
{{obj_identifier}} diff --git a/templates/email/sharing/shared_access_given.html b/templates/email/sharing/shared_access_given.html index 140e7a8..6ab759b 100644 --- a/templates/email/sharing/shared_access_given.html +++ b/templates/email/sharing/shared_access_given.html @@ -7,6 +7,7 @@
{% trans 'Hello ' %} {{user.username}},
+
{% trans 'the following dataset has just been shared with you' %}
{{obj_identifier}} diff --git a/templates/email/sharing/shared_access_given_team.html b/templates/email/sharing/shared_access_given_team.html index 990ba2d..cdf3bb1 100644 --- a/templates/email/sharing/shared_access_given_team.html +++ b/templates/email/sharing/shared_access_given_team.html @@ -7,6 +7,7 @@
{% trans 'Hello team' %} {{team.name}},
+
{% trans 'the following dataset has just been shared with your team' %}
{{obj_identifier}} diff --git a/templates/email/sharing/shared_access_removed.html b/templates/email/sharing/shared_access_removed.html index d1cbc5b..b312111 100644 --- a/templates/email/sharing/shared_access_removed.html +++ b/templates/email/sharing/shared_access_removed.html @@ -7,6 +7,7 @@
{% trans 'Hello ' %} {{user.username}},
+
{% trans 'your shared access, including editing, has been revoked for the dataset ' %}
{{obj_identifier}} diff --git a/templates/email/sharing/shared_access_removed_team.html b/templates/email/sharing/shared_access_removed_team.html index 5472ef7..992f00f 100644 --- a/templates/email/sharing/shared_access_removed_team.html +++ b/templates/email/sharing/shared_access_removed_team.html @@ -7,6 +7,7 @@
{% trans 'Hello team' %} {{team.name}},
+
{% trans 'your teams shared access, including editing, has been revoked for the dataset ' %}
{{obj_identifier}} diff --git a/user/models/team.py b/user/models/team.py index 5e728e7..7162e97 100644 --- a/user/models/team.py +++ b/user/models/team.py @@ -95,6 +95,20 @@ class Team(UuidModel, DeletableObjectMixin): mailer = Mailer() mailer.send_mail_shared_data_checked_team(obj_identifier, obj_title, self) + def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes): + """ Sends a mail to the team members in case of changed deduction values + + Args: + obj_identifier (str): Identifier of the main object + obj_title (str): Title of the main object + data_changes (dict): Contains the old|new changes of the deduction changes + + Returns: + + """ + mailer = Mailer() + mailer.send_mail_deduction_changed_team(obj_identifier, obj_title, self, data_changes) + def send_mail_shared_data_deleted(self, obj_identifier, obj_title): """ Sends a mail to the team members in case of deleted data diff --git a/user/models/user.py b/user/models/user.py index b40a3b1..20d3d50 100644 --- a/user/models/user.py +++ b/user/models/user.py @@ -145,6 +145,22 @@ class User(AbstractUser): mailer = Mailer() mailer.send_mail_shared_data_checked(obj_identifier, obj_title, self) + def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes): + """ Sends a mail to the user in case of a changed deduction + + Args: + obj_identifier (str): Identifier of the main object + obj_title (str): Title of the main object + data_changes (dict): Contains the old|new changes of the deduction changes + + Returns: + + """ + notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_DEDUCTION_CHANGES) + if notification_set: + mailer = Mailer() + mailer.send_mail_deduction_changed(obj_identifier, obj_title, self, data_changes) + def get_API_token(self): """ Getter for an API token -- 2.38.5 From 049305c32e1f7d7d8f1285debd2dfda7b88e6e01 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 10 Aug 2022 09:03:24 +0200 Subject: [PATCH 4/9] Minor changes * updates translation --- locale/de/LC_MESSAGES/django.mo | Bin 44532 -> 44517 bytes locale/de/LC_MESSAGES/django.po | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 6ee76a29ae6b97210a548c54b5f64f6f34f30f49..feda2678e509fe8e667237f2618882f674d2581e 100644 GIT binary patch delta 2071 zcmXZddu+{T9LMqRjykRNHpgW+t(L|~rFAKtxnyhEkhn!jSR!o6uqHzy86gfoL&R-K zt=-zHDq6PHrA30MZDEncR;IDc;xbt>MY2e`pk^`NAJ6mG>v_Jv-|zc{p!XMM>6nXYI2yHp$r#3II2dPR9M|G*e2N>f z@=LQ4j8>YZ;!^B|Yfy!Eq88SGs@EL&z)tFcKA?gqLtJs&j?a zWv)(BuObP&ZyfwX7Xq#RsSY|6&G)c9{*rEL6gYs5hF6 zUGPKfgCC(5upZU=N>oP<`|D?rjs$jSQ|>V=DXBm-;q?fmT+EdT=G`&32#?@4*S!gnFZYumHQ& zy0bD4M=_s@#kc{L?*~-p+AsyLqn^KuTG0QPLw(EK;{xL`%KQV&z_^cBdrzYlbPd(g zd#D1>P=_mA=L+>j<%ywQXaed`zvttnIE48o479T24CMEy#I2}=f1*0^5VgnQy)ID% zvzZS>C3*+7h09S}_=z`;`g%5@7O)kywbiJzR==12uVQeVzzEFS$0vmgkb`YEQJ>q2 z{d`JThq;(q?;M5Wn7@zNSc7?Z7S-x|sD(dAJ(t|Tr;LR-4dV@g*}Dub5?F$12i%*i zL7o0}s1b@taPJ|A+t?7!oKMnQ95mbi;pza?WFi_%=s8$#G zc?oI{=VO0djbW@poq;;kmNlcc>RZ&IyMkKyAO8A%)cuc9g%iJW3rt6yogl*C4F*vh zjU}kly$#3WS=1YKVm3a-9E^VLT3UqKf>MlO1FplLQF*3(A)cGqCLp)S@zf zp#qbbS7RdX$1pbf>&Lt&u`BTw)br<1_h0byOQ=q?p$_#;AMZfj_Xrd8{Xg>;LX9qA z7*#L@^5z+0M&((BipOyl^{s`$TueLc ze%Tg#1Jw6hh1qx%2jDN5gB{*pN8A}2gM)}qMEz}lj5?e(s0FuRGXCV}zu}2^PIPJc M)w0-$*0S8p7blZV+5i9m delta 2081 zcmXZce@xX?7{~D^zzZmtBv*~gMQ(% zzavSX?2H7Do7viCvsriqXXAM+!O(8AIarQmScj`|FKXRCI2SA4HLJ!3oP=NCJ$MG= zIEv{QYcVUunfM4k+hW0;KnEB|W8hEkRm`D3hAB8{k69LmQGp)tmSHyiN>t(+tik7T z0uEp*4q-NajoR13m9X90huT;$p!@lDhn+kRK_@pvaODq#sKK^${%CF<@s zVHCHaPS%N9cMNsKKcOl)hH=d0-tHy8Jx4=3YeX&FhDx*_75FGt;SlOXcfId^4bxC> zb3rjszh>!yW=n_Pz>|2 z3>9b@>I&aLUEx-50`==@L9J^;U2PBQtqpWg|5s_8U|=p*d}y`>8<2->S5QBZ~&*{U#NMhU2c6A>T0r4^P{K}$50h2Ma`cd&`{tiRH>_dzZP|e z^_Yj-F@)WyH_(r|vg4?$`VKSkchttO`R_MT^T&0XgLm51735Tj8}qZsF7EtcUv ztiaQ#1)&~S;&d#aUyMaqjkuw~b{Z)9CkL zDt?L~Jm$ZDCSjQD5=n*6Ze_V2XbK88j3i3l%VoN*F;c zyw881hbi Date: Wed, 10 Aug 2022 09:28:43 +0200 Subject: [PATCH 5/9] Fix * adds more detailed situation check on check_for_recorded_instance() --- konova/forms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/konova/forms.py b/konova/forms.py index ced2bf1..6701426 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -15,6 +15,7 @@ from django.contrib import messages from django.contrib.gis import gdal from django.db.models.fields.files import FieldFile +from compensation.models import EcoAccount from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP from user.models import User from django.contrib.gis.forms import MultiPolygonField @@ -156,16 +157,16 @@ class BaseForm(forms.Form): RemoveEcoAccountDeductionModalForm is_none = self.instance is None is_other_data_type = not isinstance(self.instance, BaseObject) - is_deduction_form = isinstance( + is_deduction_form_from_account = isinstance( self, ( NewDeductionModalForm, EditEcoAccountDeductionModalForm, RemoveEcoAccountDeductionModalForm, ) - ) + ) and isinstance(self.instance, EcoAccount) - if is_none or is_other_data_type or is_deduction_form: + if is_none or is_other_data_type or is_deduction_form_from_account: # Do nothing return -- 2.38.5 From 7e05d05d97cb604bf0128b4b3a4814bd201287b9 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 15 Aug 2022 08:08:15 +0200 Subject: [PATCH 6/9] Model * adds new model and mixin * adds new functionality for Mailer class for sending resubmission mails --- compensation/models/compensation.py | 7 ++- intervention/models/intervention.py | 11 +++-- konova/models/__init__.py | 1 + konova/models/object.py | 22 ++++++++- konova/models/resubmission.py | 46 +++++++++++++++++++ konova/utils/mailer.py | 23 ++++++++++ .../email/resubmission/resubmission.html | 29 ++++++++++++ 7 files changed, 133 insertions(+), 6 deletions(-) create mode 100644 konova/models/resubmission.py create mode 100644 templates/email/resubmission/resubmission.html diff --git a/compensation/models/compensation.py b/compensation/models/compensation.py index e513c95..b65d259 100644 --- a/compensation/models/compensation.py +++ b/compensation/models/compensation.py @@ -19,14 +19,17 @@ from compensation.managers import CompensationManager from compensation.models import CompensationState, CompensationAction from compensation.utils.quality import CompensationQualityChecker from konova.models import BaseObject, AbstractDocument, Deadline, generate_document_file_upload_path, \ - GeoReferencedMixin, DeadlineType + GeoReferencedMixin, DeadlineType, ResubmitableObjectMixin from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, COMPENSATION_REMOVED_TEMPLATE, \ DOCUMENT_REMOVED_TEMPLATE, DEADLINE_REMOVED, ADDED_DEADLINE, \ COMPENSATION_ACTION_REMOVED, COMPENSATION_STATE_REMOVED, INTERVENTION_HAS_REVOCATIONS_TEMPLATE from user.models import UserActionLogEntry -class AbstractCompensation(BaseObject, GeoReferencedMixin): +class AbstractCompensation(BaseObject, + GeoReferencedMixin, + ResubmitableObjectMixin + ): """ Abstract compensation model which holds basic attributes, shared by subclasses like the regular Compensation, EMA or EcoAccount. diff --git a/intervention/models/intervention.py b/intervention/models/intervention.py index dd15beb..ea561c5 100644 --- a/intervention/models/intervention.py +++ b/intervention/models/intervention.py @@ -26,14 +26,19 @@ from intervention.models.revocation import RevocationDocument, Revocation from intervention.utils.quality import InterventionQualityChecker from konova.models import generate_document_file_upload_path, AbstractDocument, BaseObject, \ ShareableObjectMixin, \ - RecordableObjectMixin, CheckableObjectMixin, GeoReferencedMixin -from konova.settings import LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT, DEFAULT_SRID_RLP + RecordableObjectMixin, CheckableObjectMixin, GeoReferencedMixin, ResubmitableObjectMixin from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE, \ PAYMENT_REMOVED, PAYMENT_ADDED, REVOCATION_REMOVED, INTERVENTION_HAS_REVOCATIONS_TEMPLATE from user.models import UserActionLogEntry -class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, CheckableObjectMixin, GeoReferencedMixin): +class Intervention(BaseObject, + ShareableObjectMixin, + RecordableObjectMixin, + CheckableObjectMixin, + GeoReferencedMixin, + ResubmitableObjectMixin + ): """ Interventions are e.g. construction sites where nature used to be. """ diff --git a/konova/models/__init__.py b/konova/models/__init__.py index c915606..ba9de1d 100644 --- a/konova/models/__init__.py +++ b/konova/models/__init__.py @@ -10,3 +10,4 @@ from .deadline import * from .document import * from .geometry import * from .parcel import * +from .resubmission import * diff --git a/konova/models/object.py b/konova/models/object.py index b468932..0fbd6e8 100644 --- a/konova/models/object.py +++ b/konova/models/object.py @@ -743,4 +743,24 @@ class GeoReferencedMixin(models.Model): zoom_lvl, x, y, - ) \ No newline at end of file + ) + + +class ResubmitableObjectMixin(models.Model): + resubmissions = models.ManyToManyField( + "konova.Resubmission", + null=True, + blank=True, + related_name="+", + ) + + class Meta: + abstract = True + + def resubmit(self): + """ Run resubmit check and run for all related resubmissions + + """ + resubmissions = self.resubmissions.all() + for resubmission in resubmissions: + resubmission.send_resubmission_mail(self.identifier) diff --git a/konova/models/resubmission.py b/konova/models/resubmission.py new file mode 100644 index 0000000..ca97ebb --- /dev/null +++ b/konova/models/resubmission.py @@ -0,0 +1,46 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from dateutil.utils import today +from django.db import models + +from konova.models import BaseResource +from konova.utils.mailer import Mailer + + +class Resubmission(BaseResource): + user = models.ForeignKey( + "user.User", + on_delete=models.CASCADE, + help_text="The user who wants to be notifed" + ) + resubmit_on = models.DateField( + help_text="On which date the resubmission should be performed" + ) + resubmission_sent = models.BooleanField( + default=False, + help_text="Whether a resubmission has been sent or not" + ) + comment = models.TextField( + null=True, + blank=True, + help_text="Optional comment for the user itself" + ) + + def send_resubmission_mail(self, obj_identifier): + """ Sends a resubmission mail + + """ + _today = today() + resubmission_handled = _today.__ge__(self.resubmit_on) and self.resubmission_sent + if resubmission_handled: + return + + mailer = Mailer() + mailer.send_mail_resubmission(obj_identifier, self) + self.resubmission_sent = True + self.save() diff --git a/konova/utils/mailer.py b/konova/utils/mailer.py index 92bd2b6..8de9119 100644 --- a/konova/utils/mailer.py +++ b/konova/utils/mailer.py @@ -398,3 +398,26 @@ class Mailer: msg ) + def send_mail_resubmission(self, obj_identifier, resubmission): + """ Send a resubmission mail for a user + + Args: + obj_identifier (str): The (resubmitted) object's identifier + resubmission (Resubmission): The resubmission + + Returns: + + """ + context = { + "obj_identifier": obj_identifier, + "resubmission": resubmission, + "EMAIL_REPLY_TO": EMAIL_REPLY_TO, + } + msg = render_to_string("email/resubmission/resubmission.html", context) + user_mail_address = [SUPPORT_MAIL_RECIPIENT] + self.send( + user_mail_address, + _("Resubmission - {}").format(obj_identifier), + msg + ) + diff --git a/templates/email/resubmission/resubmission.html b/templates/email/resubmission/resubmission.html new file mode 100644 index 0000000..25848f5 --- /dev/null +++ b/templates/email/resubmission/resubmission.html @@ -0,0 +1,29 @@ +{% load i18n %} + +
+

{% trans 'Resubmission' %}

+

{{obj_identifier}}

+
+
+ {% trans 'Hello ' %} {{resubmission.user.username}}, +
+
+ {% trans 'you wanted to be reminded on this entry.' %} +
+ {% if resubmission.comment %} +
+ {% trans 'Your personal comment:' %} +
+
"{{resubmission.comment}}"
+ {% endif %} +
+
+ {% trans 'Best regards' %} +
+ KSP +
+
+ {% include 'email/signature.html' %} +
+
+ -- 2.38.5 From 60867fdf392671bd07b3caa49610efadc6327e3b Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 15 Aug 2022 09:38:51 +0200 Subject: [PATCH 7/9] Templates + Routes * adds control button for Intervention, Compensation, Ema and EcoAccount for setting a resubmission on an entry --- .../compensation/includes/controls.html | 3 + .../detail/eco_account/includes/controls.html | 3 + compensation/urls/compensation.py | 1 + compensation/urls/eco_account.py | 1 + compensation/views/compensation.py | 26 ++++++- compensation/views/eco_account.py | 25 ++++++- .../ema/detail/includes/controls.html | 3 + ema/urls.py | 1 + ema/views.py | 27 ++++++- .../detail/includes/controls.html | 3 + intervention/urls.py | 4 +- intervention/views.py | 25 ++++++- konova/admin.py | 12 ++- konova/forms.py | 74 ++++++++++++++++++- 14 files changed, 200 insertions(+), 8 deletions(-) diff --git a/compensation/templates/compensation/detail/compensation/includes/controls.html b/compensation/templates/compensation/detail/compensation/includes/controls.html index 5be0b3e..4119480 100644 --- a/compensation/templates/compensation/detail/compensation/includes/controls.html +++ b/compensation/templates/compensation/detail/compensation/includes/controls.html @@ -12,6 +12,9 @@ {% if has_access %} + {% if is_default_member %} {% if has_access %} + diff --git a/compensation/urls/compensation.py b/compensation/urls/compensation.py index e1a41ff..6602005 100644 --- a/compensation/urls/compensation.py +++ b/compensation/urls/compensation.py @@ -31,6 +31,7 @@ urlpatterns = [ path('/deadline//edit', deadline_edit_view, name='deadline-edit'), path('/deadline//remove', deadline_remove_view, name='deadline-remove'), path('/report', report_view, name='report'), + path('/resub', create_resubmission_view, name='resubmission-create'), # Documents path('/document/new/', new_document_view, name='new-doc'), diff --git a/compensation/urls/eco_account.py b/compensation/urls/eco_account.py index a3d1aa3..5a84e8c 100644 --- a/compensation/urls/eco_account.py +++ b/compensation/urls/eco_account.py @@ -19,6 +19,7 @@ urlpatterns = [ path('/report', report_view, name='report'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), + path('/resub', create_resubmission_view, name='resubmission-create'), path('/state/new', state_new_view, name='new-state'), path('/state//edit', state_edit_view, name='state-edit'), diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py index efe51ce..016f8ea 100644 --- a/compensation/views/compensation.py +++ b/compensation/views/compensation.py @@ -14,7 +14,8 @@ from compensation.tables import CompensationTable from intervention.models import Intervention from konova.contexts import BaseContext from konova.decorators import * -from konova.forms import RemoveModalForm, SimpleGeomForm, RemoveDeadlineModalForm, EditDocumentModalForm +from konova.forms import RemoveModalForm, SimpleGeomForm, RemoveDeadlineModalForm, EditDocumentModalForm, \ + ResubmissionModalForm from konova.models import Deadline from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.utils.documents import get_document, remove_document @@ -656,3 +657,26 @@ def report_view(request: HttpRequest, id: str): } context = BaseContext(request, context).context return render(request, template, context) + + +@login_required +@default_group_required +@shared_access_required(Compensation, "id") +def create_resubmission_view(request: HttpRequest, id: str): + """ Renders resubmission form for a compensation + + Args: + request (HttpRequest): The incoming request + id (str): Compensation's id + + Returns: + + """ + com = get_object_or_404(Compensation, id=id) + form = ResubmissionModalForm(request.POST or None, instance=com, request=request) + form.action_url = reverse("compensation:resubmission-create", args=(id,)) + return form.process_request( + request, + msg_success=_("Resubmission set"), + redirect_url=reverse("compensation:detail", args=(id,)) + ) diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py index ebface8..03109a8 100644 --- a/compensation/views/eco_account.py +++ b/compensation/views/eco_account.py @@ -26,7 +26,7 @@ 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, NewDocumentModalForm, RecordModalForm, \ - RemoveDeadlineModalForm, EditDocumentModalForm + RemoveDeadlineModalForm, EditDocumentModalForm, ResubmissionModalForm 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 @@ -838,4 +838,27 @@ def create_share_view(request: HttpRequest, id: str): return form.process_request( request, msg_success=_("Share settings updated") + ) + + +@login_required +@default_group_required +@shared_access_required(EcoAccount, "id") +def create_resubmission_view(request: HttpRequest, id: str): + """ Renders resubmission form for an eco account + + Args: + request (HttpRequest): The incoming request + id (str): EcoAccount's id + + Returns: + + """ + acc = get_object_or_404(EcoAccount, id=id) + form = ResubmissionModalForm(request.POST or None, instance=acc, request=request) + form.action_url = reverse("compensation:acc:resubmission-create", args=(id,)) + return form.process_request( + request, + msg_success=_("Resubmission set"), + redirect_url=reverse("compensation:acc:detail", args=(id,)) ) \ No newline at end of file diff --git a/ema/templates/ema/detail/includes/controls.html b/ema/templates/ema/detail/includes/controls.html index 6a4f706..a16071b 100644 --- a/ema/templates/ema/detail/includes/controls.html +++ b/ema/templates/ema/detail/includes/controls.html @@ -12,6 +12,9 @@ {% if has_access %} + diff --git a/ema/urls.py b/ema/urls.py index 90cafb6..63073d6 100644 --- a/ema/urls.py +++ b/ema/urls.py @@ -19,6 +19,7 @@ urlpatterns = [ path('/remove', remove_view, name='remove'), path('/record', record_view, name='record'), path('/report', report_view, name='report'), + path('/resub', create_resubmission_view, name='resubmission-create'), path('/state/new', state_new_view, name='new-state'), path('/state//remove', state_remove_view, name='state-remove'), diff --git a/ema/views.py b/ema/views.py index 589165f..9cd6dd9 100644 --- a/ema/views.py +++ b/ema/views.py @@ -17,7 +17,7 @@ from konova.contexts import BaseContext from konova.decorators import conservation_office_group_required, shared_access_required from ema.models import Ema, EmaDocument from konova.forms import RemoveModalForm, SimpleGeomForm, RecordModalForm, RemoveDeadlineModalForm, \ - EditDocumentModalForm + EditDocumentModalForm, ResubmissionModalForm 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 @@ -710,4 +710,27 @@ def deadline_remove_view(request: HttpRequest, id: str, deadline_id: str): request, msg_success=DEADLINE_REMOVED, redirect_url=reverse("ema:detail", args=(id,)) + "#related_data" - ) \ No newline at end of file + ) + + +@login_required +@conservation_office_group_required +@shared_access_required(Ema, "id") +def create_resubmission_view(request: HttpRequest, id: str): + """ Renders resubmission form for an EMA + + Args: + request (HttpRequest): The incoming request + id (str): EMA's id + + Returns: + + """ + ema = get_object_or_404(Ema, id=id) + form = ResubmissionModalForm(request.POST or None, instance=ema, request=request) + form.action_url = reverse("ema:resubmission-create", args=(id,)) + return form.process_request( + request, + msg_success=_("Resubmission set"), + redirect_url=reverse("ema:detail", args=(id,)) + ) diff --git a/intervention/templates/intervention/detail/includes/controls.html b/intervention/templates/intervention/detail/includes/controls.html index f41c8b8..7af2165 100644 --- a/intervention/templates/intervention/detail/includes/controls.html +++ b/intervention/templates/intervention/detail/includes/controls.html @@ -12,6 +12,9 @@ {% if has_access %} + diff --git a/intervention/urls.py b/intervention/urls.py index 2a5e6d3..c7c4383 100644 --- a/intervention/urls.py +++ b/intervention/urls.py @@ -10,7 +10,8 @@ from django.urls import path from intervention.views import index_view, new_view, detail_view, edit_view, remove_view, new_document_view, share_view, \ create_share_view, remove_revocation_view, new_revocation_view, check_view, log_view, new_deduction_view, \ record_view, remove_document_view, get_document_view, get_revocation_view, new_id_view, report_view, \ - remove_deduction_view, remove_compensation_view, edit_deduction_view, edit_revocation_view, edit_document_view + remove_deduction_view, remove_compensation_view, edit_deduction_view, edit_revocation_view, edit_document_view, \ + create_resubmission_view app_name = "intervention" urlpatterns = [ @@ -26,6 +27,7 @@ urlpatterns = [ path('/check', check_view, name='check'), path('/record', record_view, name='record'), path('/report', report_view, name='report'), + path('/resub', create_resubmission_view, name='resubmission-create'), # Compensations path('/compensation//remove', remove_compensation_view, name='remove-compensation'), diff --git a/intervention/views.py b/intervention/views.py index 3657720..c55fe72 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -12,7 +12,7 @@ from intervention.models import Intervention, Revocation, InterventionDocument, from intervention.tables import InterventionTable from konova.contexts import BaseContext from konova.decorators import * -from konova.forms import SimpleGeomForm, RemoveModalForm, RecordModalForm, EditDocumentModalForm +from konova.forms import SimpleGeomForm, RemoveModalForm, RecordModalForm, EditDocumentModalForm, ResubmissionModalForm from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.utils.documents import remove_document, get_document from konova.utils.generators import generate_qr_code @@ -475,6 +475,29 @@ def create_share_view(request: HttpRequest, id: str): ) +@login_required +@default_group_required +@shared_access_required(Intervention, "id") +def create_resubmission_view(request: HttpRequest, id: str): + """ Renders resubmission form for an intervention + + Args: + request (HttpRequest): The incoming request + id (str): Intervention's id + + Returns: + + """ + intervention = get_object_or_404(Intervention, id=id) + form = ResubmissionModalForm(request.POST or None, instance=intervention, request=request) + form.action_url = reverse("intervention:resubmission-create", args=(id,)) + return form.process_request( + request, + msg_success=_("Resubmission set"), + redirect_url=reverse("intervention:detail", args=(id,)) + ) + + @login_required @registration_office_group_required @shared_access_required(Intervention, "id") diff --git a/konova/admin.py b/konova/admin.py index b30f4b1..b40a44c 100644 --- a/konova/admin.py +++ b/konova/admin.py @@ -7,7 +7,7 @@ Created on: 22.07.21 """ from django.contrib import admin -from konova.models import Geometry, Deadline, GeometryConflict, Parcel, District, Municipal, ParcelGroup +from konova.models import Geometry, Deadline, GeometryConflict, Parcel, District, Municipal, ParcelGroup, Resubmission from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE from user.models import UserAction @@ -139,6 +139,15 @@ class BaseObjectAdmin(BaseResourceAdmin, DeletableObjectMixinAdmin): ] +class ResubmissionAdmin(BaseResourceAdmin): + list_display = [ + "resubmit_on" + ] + fields = [ + "comment", + "resubmit_on" + ] + # Outcommented for a cleaner admin backend on production #admin.site.register(Geometry, GeometryAdmin) @@ -148,3 +157,4 @@ class BaseObjectAdmin(BaseResourceAdmin, DeletableObjectMixinAdmin): #admin.site.register(ParcelGroup, ParcelGroupAdmin) #admin.site.register(GeometryConflict, GeometryConflictAdmin) #admin.site.register(Deadline, DeadlineAdmin) +#admin.site.register(Resubmission, ResubmissionAdmin) diff --git a/konova/forms.py b/konova/forms.py index 6701426..5d8f38e 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -13,7 +13,9 @@ from bootstrap_modal_forms.utils import is_ajax from django import forms from django.contrib import messages from django.contrib.gis import gdal +from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields.files import FieldFile +from django.utils.timezone import now from compensation.models import EcoAccount from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP @@ -26,7 +28,7 @@ from django.shortcuts import render from django.utils.translation import gettext_lazy as _ from konova.contexts import BaseContext -from konova.models import BaseObject, Geometry, RecordableObjectMixin, AbstractDocument +from konova.models import BaseObject, Geometry, RecordableObjectMixin, AbstractDocument, Resubmission from konova.settings import DEFAULT_SRID from konova.tasks import celery_update_parcels from konova.utils.message_templates import FORM_INVALID, FILE_TYPE_UNSUPPORTED, FILE_SIZE_TOO_LARGE, DOCUMENT_EDITED @@ -161,6 +163,7 @@ class BaseForm(forms.Form): self, ( NewDeductionModalForm, + ResubmissionModalForm, EditEcoAccountDeductionModalForm, RemoveEcoAccountDeductionModalForm, ) @@ -686,3 +689,72 @@ class RecordModalForm(BaseModalForm): """ pass + + +class ResubmissionModalForm(BaseModalForm): + date = forms.DateField( + label_suffix=_(""), + label=_("Date"), + help_text=_("When do you want to be reminded?"), + widget=forms.DateInput( + attrs={ + "type": "date", + "data-provide": "datepicker", + "class": "form-control", + }, + format="%d.%m.%Y" + ) + ) + comment = forms.CharField( + required=False, + label=_("Comment"), + label_suffix=_(""), + help_text=_("Additional comment"), + widget=forms.Textarea( + attrs={ + "cols": 30, + "rows": 5, + "class": "form-control", + } + ) + ) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.form_title = _("Resubmission") + self.form_caption = _("Set your resubmission for this entry.") + self.action_url = None + + try: + self.resubmission = self.instance.resubmissions.get( + user=self.user + ) + self.initialize_form_field("date", str(self.resubmission.resubmit_on)) + self.initialize_form_field("comment", self.resubmission.comment) + except ObjectDoesNotExist: + self.resubmission = Resubmission() + + def is_valid(self): + super_valid = super().is_valid() + self_valid = True + + date = self.cleaned_data.get("date") + today = now().today().date() + if date <= today: + self.add_error( + "date", + _("The date should be in the future") + ) + self_valid = False + + return super_valid and self_valid + + def save(self): + with transaction.atomic(): + self.resubmission.user = self.user + self.resubmission.resubmit_on = self.cleaned_data.get("date") + self.resubmission.comment = self.cleaned_data.get("comment") + self.resubmission.save() + self.instance.resubmissions.add(self.resubmission) + return self.resubmission + -- 2.38.5 From 8a446818032ac489eac6acf5bf0f19653502560a Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 15 Aug 2022 10:02:07 +0200 Subject: [PATCH 8/9] Command * adds new command to be used with cron for periodic checkin of resubmissions * updates translations --- konova/admin.py | 3 +- .../commands/handle_resubmissions.py | 46 +++ konova/models/resubmission.py | 2 +- locale/de/LC_MESSAGES/django.mo | Bin 44517 -> 45149 bytes locale/de/LC_MESSAGES/django.po | 302 ++++++++++-------- 5 files changed, 226 insertions(+), 127 deletions(-) create mode 100644 konova/management/commands/handle_resubmissions.py diff --git a/konova/admin.py b/konova/admin.py index b40a44c..07d692d 100644 --- a/konova/admin.py +++ b/konova/admin.py @@ -145,7 +145,8 @@ class ResubmissionAdmin(BaseResourceAdmin): ] fields = [ "comment", - "resubmit_on" + "resubmit_on", + "resubmission_sent", ] diff --git a/konova/management/commands/handle_resubmissions.py b/konova/management/commands/handle_resubmissions.py new file mode 100644 index 0000000..047dbd5 --- /dev/null +++ b/konova/management/commands/handle_resubmissions.py @@ -0,0 +1,46 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +import datetime + +from compensation.models import Compensation, EcoAccount +from ema.models import Ema +from intervention.models import Intervention +from konova.management.commands.setup import BaseKonovaCommand +from konova.models import Resubmission + + +class Command(BaseKonovaCommand): + help = "Checks for resubmissions due now" + + def handle(self, *args, **options): + try: + resubmitable_models = [ + Intervention, + Compensation, + Ema, + EcoAccount, + ] + today = datetime.date.today() + resubmissions = Resubmission.objects.filter( + resubmit_on__lte=today, + resubmission_sent=False, + ) + self._write_warning(f"Found {resubmissions.count()} resubmission. Process now...") + for model in resubmitable_models: + all_objs = model.objects.filter( + resubmissions__in=resubmissions + ) + self._write_warning(f"Process resubmissions for {all_objs.count()} {model.__name__} entries") + for obj in all_objs: + obj.resubmit() + self._write_success("Mails have been sent.") + resubmissions.delete() + self._write_success("Resubmissions have been deleted.") + except KeyboardInterrupt: + self._break_line() + exit(-1) \ No newline at end of file diff --git a/konova/models/resubmission.py b/konova/models/resubmission.py index ca97ebb..be5fe84 100644 --- a/konova/models/resubmission.py +++ b/konova/models/resubmission.py @@ -35,7 +35,7 @@ class Resubmission(BaseResource): """ Sends a resubmission mail """ - _today = today() + _today = today().date() resubmission_handled = _today.__ge__(self.resubmit_on) and self.resubmission_sent if resubmission_handled: return diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index feda2678e509fe8e667237f2618882f674d2581e..03853f485e18ce219bb50fbd9b452d147282bbb3 100644 GIT binary patch delta 12882 zcmZA72Yk=h{>SleCSoLZ2=PM(LaYd4?;U%T8X>_|oBaLn&8yzmZg_jH7xP{2a5e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-K-M+~OU9S0B>h$Dm!FWS=&sv(ry*t*7eg*yGxF^N1c@h|y1t^Z^S z%ZZZQc$`Wd*~l|fR{(YVLG+|tIK9MvvG&JeHou2ixaL05%ht6cuS(RQ+=sYL-rk;@ zgX>&W3?aEjJR+ZBPYNH~`Df%)IH#jH{%-Tklv@#Nh(scZxNFZ%#h)qb(04>fR@*F^>De^3K)Q`zCj$rEAQK(}pg6uULDOV+Kaqky+ z6C;U?;~$d2l%u$QAZ~VJ{U6&4E^)FD;cXk!O?^0*oAQS$a2&MPMv~tmHd3yQZ!j8v z#Ad`IA}8gHqZQ={TbNEhfe5GFuj$_@WIL=#rH-}4268`Q91%!tp)MEZ1V`0LB0W^Q_ z%2hW14MRBh#Fp1v?^@enan5HPM@T|w?+Q_a@aJ3t?k7%jE-R74_1+EBsrZx_%>_;H z29ZV_qO2pxkp6qXGx7t}hZ1?-YhxSr!|e54tUlE3xA$JfRH7v3#uKh#6#gWsVlNOU zDL2Mz*bT#o9pnS>e}s+*I?YGj52l#@{}EnDxiIxNZQX6F_>ObCh>RoB3|jl2AEmbT zgtaI>B7Wh97dYSEIQ+c^bm{*nH&Vj!%AUJyErqE>Jn- z!HtL^|I=PH4r@}^h$uo{nh_TQst ziPZCtA!%kb(qg~UY0z8x&wrce<v%(SB%fo;xhWSRpG)*8MqwVwVtX\n" "Language-Team: LANGUAGE \n" @@ -85,7 +86,7 @@ msgstr "Bericht generieren" msgid "Select a timespan and the desired conservation office" msgstr "Wählen Sie die Zeitspanne und die gewünschte Eintragungsstelle" -#: analysis/forms.py:71 konova/forms.py:227 +#: analysis/forms.py:71 konova/forms.py:231 msgid "Continue" msgstr "Weiter" @@ -241,7 +242,8 @@ msgstr "" #: ema/templates/ema/detail/includes/states-after.html:36 #: ema/templates/ema/detail/includes/states-before.html:36 #: intervention/forms/modalForms.py:364 -#: templates/email/other/deduction_changed.html:29 +#: templates/email/other/deduction_changed.html:31 +#: templates/email/other/deduction_changed_team.html:31 msgid "Surface" msgstr "Fläche" @@ -308,7 +310,8 @@ msgstr "Typ" #: intervention/forms/modalForms.py:382 intervention/tables.py:87 #: intervention/templates/intervention/detail/view.html:19 #: konova/templates/konova/includes/quickstart/interventions.html:4 -#: templates/email/other/deduction_changed.html:24 +#: templates/email/other/deduction_changed.html:26 +#: templates/email/other/deduction_changed_team.html:26 #: templates/navbars/navbar.html:22 msgid "Intervention" msgstr "Eingriff" @@ -362,7 +365,7 @@ msgstr "Automatisch generiert" #: intervention/templates/intervention/detail/includes/documents.html:28 #: intervention/templates/intervention/detail/view.html:31 #: intervention/templates/intervention/report/report.html:12 -#: konova/forms.py:438 +#: konova/forms.py:442 msgid "Title" msgstr "Bezeichnung" @@ -389,12 +392,13 @@ msgstr "Kompensation XY; Flur ABC" #: intervention/templates/intervention/detail/includes/documents.html:34 #: intervention/templates/intervention/detail/includes/payments.html:34 #: intervention/templates/intervention/detail/includes/revocation.html:38 -#: konova/forms.py:473 konova/templates/konova/includes/comment_card.html:16 +#: konova/forms.py:477 konova/forms.py:710 +#: konova/templates/konova/includes/comment_card.html:16 msgid "Comment" msgstr "Kommentar" #: compensation/forms/forms.py:59 compensation/forms/modalForms.py:471 -#: intervention/forms/forms.py:200 +#: intervention/forms/forms.py:200 konova/forms.py:712 msgid "Additional comment" msgstr "Zusätzlicher Kommentar" @@ -479,7 +483,7 @@ msgstr "kompensiert Eingriff" msgid "Select the intervention for which this compensation compensates" msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist" -#: compensation/forms/forms.py:219 compensation/views/compensation.py:110 +#: compensation/forms/forms.py:219 compensation/views/compensation.py:111 msgid "New compensation" msgstr "Neue Kompensation" @@ -531,7 +535,7 @@ msgid "Due on which date" msgstr "Zahlung wird an diesem Datum erwartet" #: compensation/forms/modalForms.py:65 compensation/forms/modalForms.py:363 -#: intervention/forms/modalForms.py:177 konova/forms.py:475 +#: intervention/forms/modalForms.py:177 konova/forms.py:479 msgid "Additional comment, maximum {} letters" msgstr "Zusätzlicher Kommentar, maximal {} Zeichen" @@ -576,7 +580,7 @@ msgstr "Neuer Zustand" msgid "Insert data for the new state" msgstr "Geben Sie die Daten des neuen Zustandes ein" -#: compensation/forms/modalForms.py:219 konova/forms.py:229 +#: compensation/forms/modalForms.py:219 konova/forms.py:233 msgid "Object removed" msgstr "Objekt entfernt" @@ -602,7 +606,7 @@ msgstr "Fristart wählen" #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:36 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:36 #: ema/templates/ema/detail/includes/deadlines.html:36 -#: intervention/forms/modalForms.py:149 +#: intervention/forms/modalForms.py:149 konova/forms.py:697 msgid "Date" msgstr "Datum" @@ -850,24 +854,32 @@ msgstr "In LANIS öffnen" msgid "Public report" msgstr "Öffentlicher Bericht" -#: compensation/templates/compensation/detail/compensation/includes/controls.html:17 -#: compensation/templates/compensation/detail/eco_account/includes/controls.html:31 -#: ema/templates/ema/detail/includes/controls.html:31 -#: intervention/templates/intervention/detail/includes/controls.html:36 +#: compensation/templates/compensation/detail/compensation/includes/controls.html:15 +#: compensation/templates/compensation/detail/eco_account/includes/controls.html:15 +#: ema/templates/ema/detail/includes/controls.html:15 +#: intervention/templates/intervention/detail/includes/controls.html:15 +#: konova/forms.py:724 templates/email/resubmission/resubmission.html:4 +msgid "Resubmission" +msgstr "Wiedervorlage" + +#: compensation/templates/compensation/detail/compensation/includes/controls.html:20 +#: compensation/templates/compensation/detail/eco_account/includes/controls.html:34 +#: ema/templates/ema/detail/includes/controls.html:34 +#: intervention/templates/intervention/detail/includes/controls.html:39 msgid "Edit" msgstr "Bearbeiten" -#: compensation/templates/compensation/detail/compensation/includes/controls.html:21 -#: compensation/templates/compensation/detail/eco_account/includes/controls.html:35 -#: ema/templates/ema/detail/includes/controls.html:35 -#: intervention/templates/intervention/detail/includes/controls.html:40 -msgid "Show log" -msgstr "Log anzeigen" - #: compensation/templates/compensation/detail/compensation/includes/controls.html:24 #: compensation/templates/compensation/detail/eco_account/includes/controls.html:38 #: ema/templates/ema/detail/includes/controls.html:38 #: intervention/templates/intervention/detail/includes/controls.html:43 +msgid "Show log" +msgstr "Log anzeigen" + +#: compensation/templates/compensation/detail/compensation/includes/controls.html:27 +#: compensation/templates/compensation/detail/eco_account/includes/controls.html:41 +#: ema/templates/ema/detail/includes/controls.html:41 +#: intervention/templates/intervention/detail/includes/controls.html:46 #: venv/lib/python3.7/site-packages/django/forms/formsets.py:391 msgid "Delete" msgstr "Löschen" @@ -907,7 +919,7 @@ msgstr "Dokumente" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:14 #: ema/templates/ema/detail/includes/documents.html:14 #: intervention/templates/intervention/detail/includes/documents.html:14 -#: konova/forms.py:491 +#: konova/forms.py:495 msgid "Add new document" msgstr "Neues Dokument hinzufügen" @@ -915,7 +927,7 @@ msgstr "Neues Dokument hinzufügen" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:31 #: ema/templates/ema/detail/includes/documents.html:31 #: intervention/templates/intervention/detail/includes/documents.html:31 -#: konova/forms.py:448 +#: konova/forms.py:452 msgid "Created on" msgstr "Erstellt" @@ -923,7 +935,7 @@ msgstr "Erstellt" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:61 #: ema/templates/ema/detail/includes/documents.html:61 #: intervention/templates/intervention/detail/includes/documents.html:65 -#: konova/forms.py:553 +#: konova/forms.py:557 msgid "Edit document" msgstr "Dokument bearbeiten" @@ -1093,22 +1105,22 @@ msgstr "" msgid "other users" msgstr "weitere Nutzer" -#: compensation/templates/compensation/detail/eco_account/includes/controls.html:15 -#: ema/templates/ema/detail/includes/controls.html:15 +#: compensation/templates/compensation/detail/eco_account/includes/controls.html:18 +#: ema/templates/ema/detail/includes/controls.html:18 #: intervention/forms/modalForms.py:71 -#: intervention/templates/intervention/detail/includes/controls.html:15 +#: intervention/templates/intervention/detail/includes/controls.html:18 msgid "Share" msgstr "Freigabe" -#: compensation/templates/compensation/detail/eco_account/includes/controls.html:20 -#: ema/templates/ema/detail/includes/controls.html:20 -#: intervention/templates/intervention/detail/includes/controls.html:25 +#: compensation/templates/compensation/detail/eco_account/includes/controls.html:23 +#: ema/templates/ema/detail/includes/controls.html:23 +#: intervention/templates/intervention/detail/includes/controls.html:28 msgid "Unrecord" msgstr "Entzeichnen" -#: compensation/templates/compensation/detail/eco_account/includes/controls.html:24 -#: ema/templates/ema/detail/includes/controls.html:24 -#: intervention/templates/intervention/detail/includes/controls.html:29 +#: compensation/templates/compensation/detail/eco_account/includes/controls.html:27 +#: ema/templates/ema/detail/includes/controls.html:27 +#: intervention/templates/intervention/detail/includes/controls.html:32 msgid "Record" msgstr "Verzeichnen" @@ -1215,29 +1227,34 @@ msgstr "" msgid "Responsible data" msgstr "Daten zu den verantwortlichen Stellen" -#: compensation/views/compensation.py:53 +#: compensation/views/compensation.py:54 msgid "Compensations - Overview" msgstr "Kompensationen - Übersicht" -#: compensation/views/compensation.py:172 konova/utils/message_templates.py:36 +#: compensation/views/compensation.py:173 konova/utils/message_templates.py:36 msgid "Compensation {} edited" msgstr "Kompensation {} bearbeitet" -#: compensation/views/compensation.py:182 compensation/views/eco_account.py:173 +#: compensation/views/compensation.py:183 compensation/views/eco_account.py:173 #: ema/views.py:241 intervention/views.py:338 msgid "Edit {}" msgstr "Bearbeite {}" -#: compensation/views/compensation.py:269 compensation/views/eco_account.py:360 -#: ema/views.py:195 intervention/views.py:542 +#: compensation/views/compensation.py:270 compensation/views/eco_account.py:360 +#: ema/views.py:195 intervention/views.py:565 msgid "Log" msgstr "Log" -#: compensation/views/compensation.py:613 compensation/views/eco_account.py:728 -#: ema/views.py:559 intervention/views.py:688 +#: compensation/views/compensation.py:614 compensation/views/eco_account.py:728 +#: ema/views.py:559 intervention/views.py:711 msgid "Report {}" msgstr "Bericht {}" +#: compensation/views/compensation.py:680 compensation/views/eco_account.py:862 +#: ema/views.py:734 intervention/views.py:496 +msgid "Resubmission set" +msgstr "Wiedervorlage gesetzt" + #: compensation/views/eco_account.py:65 msgid "Eco-account - Overview" msgstr "Ökokonten - Übersicht" @@ -1255,12 +1272,12 @@ msgid "Eco-account removed" msgstr "Ökokonto entfernt" #: compensation/views/eco_account.py:381 ema/views.py:283 -#: intervention/views.py:641 +#: intervention/views.py:664 msgid "{} unrecorded" msgstr "{} entzeichnet" #: compensation/views/eco_account.py:381 ema/views.py:283 -#: intervention/views.py:641 +#: intervention/views.py:664 msgid "{} recorded" msgstr "{} verzeichnet" @@ -1462,11 +1479,11 @@ msgid "Checked compensations data and payments" msgstr "Kompensationen und Zahlungen geprüft" #: intervention/forms/modalForms.py:263 -#: intervention/templates/intervention/detail/includes/controls.html:19 +#: intervention/templates/intervention/detail/includes/controls.html:22 msgid "Run check" msgstr "Prüfung vornehmen" -#: intervention/forms/modalForms.py:264 konova/forms.py:594 +#: intervention/forms/modalForms.py:264 konova/forms.py:598 msgid "" "I, {} {}, confirm that all necessary control steps have been performed by " "myself." @@ -1622,11 +1639,11 @@ msgstr "Eingriff {} bearbeitet" msgid "{} removed" msgstr "{} entfernt" -#: intervention/views.py:495 +#: intervention/views.py:518 msgid "Check performed" msgstr "Prüfung durchgeführt" -#: intervention/views.py:646 +#: intervention/views.py:669 msgid "There are errors on this intervention:" msgstr "Es liegen Fehler in diesem Eingriff vor:" @@ -1711,78 +1728,90 @@ msgstr "Nach Zulassungsbehörde suchen" msgid "Search for conservation office" msgstr "Nch Eintragungsstelle suchen" -#: konova/forms.py:41 templates/form/collapsable/form.html:62 +#: konova/forms.py:44 templates/form/collapsable/form.html:62 msgid "Save" msgstr "Speichern" -#: konova/forms.py:75 +#: konova/forms.py:78 msgid "Not editable" msgstr "Nicht editierbar" -#: konova/forms.py:178 konova/forms.py:394 +#: konova/forms.py:182 konova/forms.py:398 msgid "Confirm" msgstr "Bestätige" -#: konova/forms.py:190 konova/forms.py:403 +#: konova/forms.py:194 konova/forms.py:407 msgid "Remove" msgstr "Löschen" -#: konova/forms.py:192 +#: konova/forms.py:196 msgid "You are about to remove {} {}" msgstr "Sie sind dabei {} {} zu löschen" -#: konova/forms.py:280 konova/utils/quality.py:44 konova/utils/quality.py:46 +#: konova/forms.py:284 konova/utils/quality.py:44 konova/utils/quality.py:46 #: templates/form/collapsable/form.html:45 msgid "Geometry" msgstr "Geometrie" -#: konova/forms.py:331 +#: konova/forms.py:335 msgid "Only surfaces allowed. Points or lines must be buffered." msgstr "" "Nur Flächen erlaubt. Punkte oder Linien müssen zu Flächen gepuffert werden." -#: konova/forms.py:404 +#: konova/forms.py:408 msgid "Are you sure?" msgstr "Sind Sie sicher?" -#: konova/forms.py:450 +#: konova/forms.py:454 msgid "When has this file been created? Important for photos." msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?" -#: konova/forms.py:461 +#: konova/forms.py:465 #: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231 msgid "File" msgstr "Datei" -#: konova/forms.py:463 +#: konova/forms.py:467 msgid "Allowed formats: pdf, jpg, png. Max size 15 MB." msgstr "Formate: pdf, jpg, png. Maximal 15 MB." -#: konova/forms.py:528 +#: konova/forms.py:532 msgid "Added document" msgstr "Dokument hinzugefügt" -#: konova/forms.py:585 +#: konova/forms.py:589 msgid "Confirm record" msgstr "Verzeichnen bestätigen" -#: konova/forms.py:593 +#: konova/forms.py:597 msgid "Record data" msgstr "Daten verzeichnen" -#: konova/forms.py:600 +#: konova/forms.py:604 msgid "Confirm unrecord" msgstr "Entzeichnen bestätigen" -#: konova/forms.py:601 +#: konova/forms.py:605 msgid "Unrecord data" msgstr "Daten entzeichnen" -#: konova/forms.py:602 +#: konova/forms.py:606 msgid "I, {} {}, confirm that this data must be unrecorded." msgstr "" "Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen." +#: konova/forms.py:698 +msgid "When do you want to be reminded?" +msgstr "Wann wollen Sie erinnert werden?" + +#: konova/forms.py:725 +msgid "Set your resubmission for this entry." +msgstr "Setzen Sie eine Wiedervorlage für diesen Eintrag." + +#: konova/forms.py:746 +msgid "The date should be in the future" +msgstr "Das Datum sollte in der Zukunft liegen" + #: konova/management/commands/setup_data.py:26 msgid "On shared access gained" msgstr "Wenn mir eine Freigabe zu Daten erteilt wird" @@ -1929,7 +1958,7 @@ msgstr "{} - Freigegebene Daten verzeichnet" msgid "{} - Shared data checked" msgstr "{} - Freigegebene Daten geprüft" -#: konova/utils/mailer.py:233 konova/utils/mailer.py:372 +#: konova/utils/mailer.py:233 konova/utils/mailer.py:376 msgid "{} - Deduction changed" msgstr "{} - Abbuchung geändert" @@ -1937,10 +1966,14 @@ msgstr "{} - Abbuchung geändert" msgid "{} - Shared data deleted" msgstr "{} - Freigegebene Daten gelöscht" -#: konova/utils/mailer.py:393 templates/email/api/verify_token.html:4 +#: konova/utils/mailer.py:397 templates/email/api/verify_token.html:4 msgid "Request for new API token" msgstr "Anfrage für neuen API Token" +#: konova/utils/mailer.py:420 +msgid "Resubmission - {}" +msgstr "Wiedervorlage - {}" + #: konova/utils/message_templates.py:10 msgid "no further details" msgstr "keine weitere Angabe" @@ -2223,11 +2256,11 @@ msgstr "Irgendetwas ist passiert. Wir arbeiten daran!" msgid "Hello support" msgstr "Hallo Support" -#: templates/email/api/verify_token.html:9 +#: templates/email/api/verify_token.html:10 msgid "you need to verify the API token for user" msgstr "Sie müssen einen API Token für folgenden Nutzer freischalten" -#: templates/email/api/verify_token.html:15 +#: templates/email/api/verify_token.html:16 msgid "" "If unsure, please contact the user. The API token can not be used until you " "activated it in the admin backend." @@ -2236,20 +2269,22 @@ msgstr "" "Token kann so lange nicht verwendet werden, wie er noch nicht von Ihnen im " "Admin Backend aktiviert worden ist." -#: templates/email/api/verify_token.html:18 -#: templates/email/checking/shared_data_checked.html:19 -#: templates/email/checking/shared_data_checked_team.html:19 -#: templates/email/deleting/shared_data_deleted.html:19 -#: templates/email/deleting/shared_data_deleted_team.html:19 -#: templates/email/other/deduction_changed.html:38 -#: templates/email/recording/shared_data_recorded.html:19 -#: templates/email/recording/shared_data_recorded_team.html:19 -#: templates/email/recording/shared_data_unrecorded.html:19 -#: templates/email/recording/shared_data_unrecorded_team.html:19 -#: templates/email/sharing/shared_access_given.html:20 -#: templates/email/sharing/shared_access_given_team.html:20 -#: templates/email/sharing/shared_access_removed.html:20 -#: templates/email/sharing/shared_access_removed_team.html:20 +#: templates/email/api/verify_token.html:19 +#: templates/email/checking/shared_data_checked.html:20 +#: templates/email/checking/shared_data_checked_team.html:20 +#: templates/email/deleting/shared_data_deleted.html:20 +#: templates/email/deleting/shared_data_deleted_team.html:20 +#: templates/email/other/deduction_changed.html:41 +#: templates/email/other/deduction_changed_team.html:41 +#: templates/email/recording/shared_data_recorded.html:20 +#: templates/email/recording/shared_data_recorded_team.html:20 +#: templates/email/recording/shared_data_unrecorded.html:20 +#: templates/email/recording/shared_data_unrecorded_team.html:20 +#: templates/email/resubmission/resubmission.html:21 +#: templates/email/sharing/shared_access_given.html:21 +#: templates/email/sharing/shared_access_given_team.html:21 +#: templates/email/sharing/shared_access_removed.html:21 +#: templates/email/sharing/shared_access_removed_team.html:21 msgid "Best regards" msgstr "Beste Grüße" @@ -2263,18 +2298,19 @@ msgstr "Freigegebene Daten geprüft" #: templates/email/other/deduction_changed.html:8 #: templates/email/recording/shared_data_recorded.html:8 #: templates/email/recording/shared_data_unrecorded.html:8 +#: templates/email/resubmission/resubmission.html:8 #: templates/email/sharing/shared_access_given.html:8 #: templates/email/sharing/shared_access_removed.html:8 msgid "Hello " msgstr "Hallo " -#: templates/email/checking/shared_data_checked.html:10 -#: templates/email/checking/shared_data_checked_team.html:10 +#: templates/email/checking/shared_data_checked.html:11 +#: templates/email/checking/shared_data_checked_team.html:11 msgid "the following dataset has just been checked" msgstr "der folgende Datensatz wurde soeben geprüft " -#: templates/email/checking/shared_data_checked.html:16 -#: templates/email/checking/shared_data_checked_team.html:16 +#: templates/email/checking/shared_data_checked.html:17 +#: templates/email/checking/shared_data_checked_team.html:17 msgid "" "This means, the responsible registration office just confirmed the " "correctness of this dataset." @@ -2284,6 +2320,7 @@ msgstr "" #: templates/email/checking/shared_data_checked_team.html:8 #: templates/email/deleting/shared_data_deleted_team.html:8 +#: templates/email/other/deduction_changed_team.html:8 #: templates/email/recording/shared_data_recorded_team.html:8 #: templates/email/recording/shared_data_unrecorded_team.html:8 #: templates/email/sharing/shared_access_given_team.html:8 @@ -2296,14 +2333,15 @@ msgstr "Hallo Team" msgid "Shared data deleted" msgstr "Freigegebene Daten gelöscht" -#: templates/email/deleting/shared_data_deleted.html:10 -#: templates/email/deleting/shared_data_deleted_team.html:10 +#: templates/email/deleting/shared_data_deleted.html:11 +#: templates/email/deleting/shared_data_deleted_team.html:11 msgid "the following dataset has just been deleted" msgstr "der folgende Datensatz wurde soeben gelöscht " -#: templates/email/deleting/shared_data_deleted.html:16 -#: templates/email/deleting/shared_data_deleted_team.html:16 -#: templates/email/other/deduction_changed.html:35 +#: templates/email/deleting/shared_data_deleted.html:17 +#: templates/email/deleting/shared_data_deleted_team.html:17 +#: templates/email/other/deduction_changed.html:38 +#: templates/email/other/deduction_changed_team.html:38 msgid "" "If this should not have been happened, please contact us. See the signature " "for details." @@ -2312,27 +2350,33 @@ msgstr "" "mail Signatur finden Sie weitere Kontaktinformationen." #: templates/email/other/deduction_changed.html:4 +#: templates/email/other/deduction_changed_team.html:4 msgid "Deduction changed" msgstr "Abbuchung geändert" -#: templates/email/other/deduction_changed.html:10 +#: templates/email/other/deduction_changed.html:11 +#: templates/email/other/deduction_changed_team.html:11 msgid "a deduction of this eco account has changed:" msgstr "eine Abbuchung des Ökokontos hat sich geändert:" -#: templates/email/other/deduction_changed.html:14 +#: templates/email/other/deduction_changed.html:16 +#: templates/email/other/deduction_changed_team.html:16 msgid "Attribute" msgstr "Attribute" -#: templates/email/other/deduction_changed.html:15 +#: templates/email/other/deduction_changed.html:17 +#: templates/email/other/deduction_changed_team.html:17 msgid "Old" msgstr "Alt" -#: templates/email/other/deduction_changed.html:16 +#: templates/email/other/deduction_changed.html:18 +#: templates/email/other/deduction_changed_team.html:18 #: templates/generic_index.html:43 user/templates/user/team/index.html:22 msgid "New" msgstr "Neu" -#: templates/email/other/deduction_changed.html:19 +#: templates/email/other/deduction_changed.html:21 +#: templates/email/other/deduction_changed_team.html:21 msgid "EcoAccount" msgstr "Ökokonto" @@ -2341,19 +2385,19 @@ msgstr "Ökokonto" msgid "Shared data recorded" msgstr "Freigegebene Daten verzeichnet" -#: templates/email/recording/shared_data_recorded.html:10 -#: templates/email/recording/shared_data_recorded_team.html:10 +#: templates/email/recording/shared_data_recorded.html:11 +#: templates/email/recording/shared_data_recorded_team.html:11 msgid "the following dataset has just been recorded" msgstr "der folgende Datensatz wurde soeben verzeichnet " -#: templates/email/recording/shared_data_recorded.html:16 -#: templates/email/recording/shared_data_recorded_team.html:16 +#: templates/email/recording/shared_data_recorded.html:17 +#: templates/email/recording/shared_data_recorded_team.html:17 msgid "This means the data is now publicly available, e.g. in LANIS" msgstr "" "Das bedeutet, dass die Daten nun öffentlich verfügbar sind, z.B. im LANIS." -#: templates/email/recording/shared_data_recorded.html:26 -#: templates/email/recording/shared_data_recorded_team.html:26 +#: templates/email/recording/shared_data_recorded.html:27 +#: templates/email/recording/shared_data_recorded_team.html:27 msgid "" "Please note: Recorded intervention means the compensations are recorded as " "well." @@ -2366,18 +2410,18 @@ msgstr "" msgid "Shared data unrecorded" msgstr "Freigegebene Daten entzeichnet" -#: templates/email/recording/shared_data_unrecorded.html:10 -#: templates/email/recording/shared_data_unrecorded_team.html:10 +#: templates/email/recording/shared_data_unrecorded.html:11 +#: templates/email/recording/shared_data_unrecorded_team.html:11 msgid "the following dataset has just been unrecorded" msgstr "der folgende Datensatz wurde soeben entzeichnet " -#: templates/email/recording/shared_data_unrecorded.html:16 -#: templates/email/recording/shared_data_unrecorded_team.html:16 +#: templates/email/recording/shared_data_unrecorded.html:17 +#: templates/email/recording/shared_data_unrecorded_team.html:17 msgid "This means the data is no longer publicly available." msgstr "Das bedeutet, dass die Daten nicht länger öffentlich verfügbar sind." -#: templates/email/recording/shared_data_unrecorded.html:26 -#: templates/email/recording/shared_data_unrecorded_team.html:26 +#: templates/email/recording/shared_data_unrecorded.html:27 +#: templates/email/recording/shared_data_unrecorded_team.html:27 msgid "" "Please note: Unrecorded intervention means the compensations are unrecorded " "as well." @@ -2385,22 +2429,30 @@ msgstr "" "Bitte beachten Sie: Entzeichnete Eingriffe bedeuten, dass auch die " "zugehörigen Kompensationen automatisch entzeichnet worden sind." +#: templates/email/resubmission/resubmission.html:11 +msgid "you wanted to be reminded on this entry." +msgstr "Sie wollten an diesen Eintrag erinnert werden." + +#: templates/email/resubmission/resubmission.html:15 +msgid "Your personal comment:" +msgstr "Ihr Kommentar:" + #: templates/email/sharing/shared_access_given.html:4 #: templates/email/sharing/shared_access_given_team.html:4 msgid "Access shared" msgstr "Zugriff freigegeben" -#: templates/email/sharing/shared_access_given.html:10 +#: templates/email/sharing/shared_access_given.html:11 msgid "the following dataset has just been shared with you" msgstr "der folgende Datensatz wurde soeben für Sie freigegeben " -#: templates/email/sharing/shared_access_given.html:16 -#: templates/email/sharing/shared_access_given_team.html:16 +#: templates/email/sharing/shared_access_given.html:17 +#: templates/email/sharing/shared_access_given_team.html:17 msgid "This means you can now edit this dataset." msgstr "Das bedeutet, dass Sie diesen Datensatz nun auch bearbeiten können." -#: templates/email/sharing/shared_access_given.html:17 -#: templates/email/sharing/shared_access_given_team.html:17 +#: templates/email/sharing/shared_access_given.html:18 +#: templates/email/sharing/shared_access_given_team.html:18 msgid "" "The shared dataset appears now by default on your overview for this dataset " "type." @@ -2408,8 +2460,8 @@ msgstr "" "Der freigegebene Datensatz ist nun standardmäßig in Ihrer Übersicht für den " "Datensatztyp im KSP gelistet." -#: templates/email/sharing/shared_access_given.html:27 -#: templates/email/sharing/shared_access_given_team.html:27 +#: templates/email/sharing/shared_access_given.html:28 +#: templates/email/sharing/shared_access_given_team.html:28 msgid "" "Please note: Shared access on an intervention means you automatically have " "editing access to related compensations." @@ -2418,7 +2470,7 @@ msgstr "" "Sie automatisch auch Zugriff auf die zugehörigen Kompensationen erhalten " "haben." -#: templates/email/sharing/shared_access_given_team.html:10 +#: templates/email/sharing/shared_access_given_team.html:11 msgid "the following dataset has just been shared with your team" msgstr "der folgende Datensatz wurde soeben für Ihr Team freigegeben " @@ -2427,20 +2479,20 @@ msgstr "der folgende Datensatz wurde soeben für Ihr Team freigegeben " msgid "Shared access removed" msgstr "Freigegebener Zugriff entzogen" -#: templates/email/sharing/shared_access_removed.html:10 +#: templates/email/sharing/shared_access_removed.html:11 msgid "" "your shared access, including editing, has been revoked for the dataset " msgstr "" "Ihnen wurde soeben der bearbeitende Zugriff auf den folgenden Datensatz " "entzogen: " -#: templates/email/sharing/shared_access_removed.html:16 -#: templates/email/sharing/shared_access_removed_team.html:16 +#: templates/email/sharing/shared_access_removed.html:17 +#: templates/email/sharing/shared_access_removed_team.html:17 msgid "However, you are still able to view the dataset content." msgstr "Sie können den Datensatz aber immer noch im KSP einsehen." -#: templates/email/sharing/shared_access_removed.html:17 -#: templates/email/sharing/shared_access_removed_team.html:17 +#: templates/email/sharing/shared_access_removed.html:18 +#: templates/email/sharing/shared_access_removed_team.html:18 msgid "" "Please use the provided search filter on the dataset`s overview pages to " "find them." @@ -2448,7 +2500,7 @@ msgstr "" "Nutzen Sie hierzu einfach die entsprechenden Suchfilter auf den " "Übersichtsseiten" -#: templates/email/sharing/shared_access_removed_team.html:10 +#: templates/email/sharing/shared_access_removed_team.html:11 msgid "" "your teams shared access, including editing, has been revoked for the " "dataset " -- 2.38.5 From 0bf2051bdf6debb3c508ee06f03c51970d104d2b Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 15 Aug 2022 10:50:01 +0200 Subject: [PATCH 9/9] Migrations + Cleanup * adds needed migrations * refactors forms.py (700+ lines) in main konova app * splits into forms/ and forms/modals and single class/topic-files for better maintainability and overview * fixes bug in main konova app migration which could occur if a certain compensation migration did not run before --- compensation/forms/modalForms.py | 2 +- .../migrations/0008_auto_20220815_0803.py | 24 + .../migrations/0009_auto_20220815_0803.py | 32 + .../migrations/0010_auto_20220815_1030.py | 24 + compensation/views/compensation.py | 3 +- compensation/views/eco_account.py | 5 +- compensation/views/payment.py | 1 - ema/forms.py | 5 +- ema/migrations/0005_ema_resubmission.py | 19 + ema/migrations/0006_auto_20220815_0803.py | 23 + ema/migrations/0007_auto_20220815_1030.py | 19 + ema/views.py | 3 +- intervention/forms/forms.py | 3 +- intervention/forms/modalForms.py | 3 +- .../0005_intervention_resubmission.py | 19 + .../migrations/0006_auto_20220815_0803.py | 23 + .../migrations/0007_auto_20220815_1030.py | 19 + intervention/views.py | 3 +- konova/forms.py | 760 ------------------ konova/forms/__init__.py | 11 + konova/forms/base_form.py | 157 ++++ konova/forms/geometry_form.py | 133 +++ konova/forms/modals/__init__.py | 12 + konova/forms/modals/base_form.py | 73 ++ konova/forms/modals/document_form.py | 163 ++++ konova/forms/modals/record_form.py | 123 +++ konova/forms/modals/remove_form.py | 58 ++ konova/forms/modals/resubmission_form.py | 85 ++ konova/forms/remove_form.py | 54 ++ konova/migrations/0005_auto_20220216_0856.py | 1 + konova/migrations/0014_resubmission.py | 33 + konova/models/object.py | 1 - konova/utils/documents.py | 5 +- user/forms.py | 3 +- user/migrations/0006_auto_20220815_0759.py | 18 + 35 files changed, 1143 insertions(+), 777 deletions(-) create mode 100644 compensation/migrations/0008_auto_20220815_0803.py create mode 100644 compensation/migrations/0009_auto_20220815_0803.py create mode 100644 compensation/migrations/0010_auto_20220815_1030.py create mode 100644 ema/migrations/0005_ema_resubmission.py create mode 100644 ema/migrations/0006_auto_20220815_0803.py create mode 100644 ema/migrations/0007_auto_20220815_1030.py create mode 100644 intervention/migrations/0005_intervention_resubmission.py create mode 100644 intervention/migrations/0006_auto_20220815_0803.py create mode 100644 intervention/migrations/0007_auto_20220815_1030.py delete mode 100644 konova/forms.py create mode 100644 konova/forms/__init__.py create mode 100644 konova/forms/base_form.py create mode 100644 konova/forms/geometry_form.py create mode 100644 konova/forms/modals/__init__.py create mode 100644 konova/forms/modals/base_form.py create mode 100644 konova/forms/modals/document_form.py create mode 100644 konova/forms/modals/record_form.py create mode 100644 konova/forms/modals/remove_form.py create mode 100644 konova/forms/modals/resubmission_form.py create mode 100644 konova/forms/remove_form.py create mode 100644 konova/migrations/0014_resubmission.py create mode 100644 user/migrations/0006_auto_20220815_0759.py diff --git a/compensation/forms/modalForms.py b/compensation/forms/modalForms.py index 581a7b3..ef21aa3 100644 --- a/compensation/forms/modalForms.py +++ b/compensation/forms/modalForms.py @@ -20,7 +20,7 @@ from compensation.models import CompensationDocument, EcoAccountDocument from intervention.inputs import CompensationActionTreeCheckboxSelectMultiple, \ CompensationStateTreeRadioSelect from konova.contexts import BaseContext -from konova.forms import BaseModalForm, NewDocumentModalForm, RemoveModalForm +from konova.forms.modals import BaseModalForm, NewDocumentModalForm, RemoveModalForm from konova.models import DeadlineType from konova.utils.message_templates import FORM_INVALID, ADDED_COMPENSATION_STATE, \ ADDED_COMPENSATION_ACTION, PAYMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, DEADLINE_EDITED diff --git a/compensation/migrations/0008_auto_20220815_0803.py b/compensation/migrations/0008_auto_20220815_0803.py new file mode 100644 index 0000000..a4d6313 --- /dev/null +++ b/compensation/migrations/0008_auto_20220815_0803.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('compensation', '0007_auto_20220531_1245'), + ] + + operations = [ + migrations.AddField( + model_name='compensation', + name='resubmission', + field=models.ManyToManyField(blank=True, null=True, related_name='_compensation_resubmission_+', to='konova.Resubmission'), + ), + migrations.AddField( + model_name='ecoaccount', + name='resubmission', + field=models.ManyToManyField(blank=True, null=True, related_name='_ecoaccount_resubmission_+', to='konova.Resubmission'), + ), + ] diff --git a/compensation/migrations/0009_auto_20220815_0803.py b/compensation/migrations/0009_auto_20220815_0803.py new file mode 100644 index 0000000..a7c00e6 --- /dev/null +++ b/compensation/migrations/0009_auto_20220815_0803.py @@ -0,0 +1,32 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('compensation', '0008_auto_20220815_0803'), + ] + + operations = [ + migrations.RemoveField( + model_name='compensation', + name='resubmission', + ), + migrations.RemoveField( + model_name='ecoaccount', + name='resubmission', + ), + migrations.AddField( + model_name='compensation', + name='resubmissions', + field=models.ManyToManyField(blank=True, null=True, related_name='_compensation_resubmissions_+', to='konova.Resubmission'), + ), + migrations.AddField( + model_name='ecoaccount', + name='resubmissions', + field=models.ManyToManyField(blank=True, null=True, related_name='_ecoaccount_resubmissions_+', to='konova.Resubmission'), + ), + ] diff --git a/compensation/migrations/0010_auto_20220815_1030.py b/compensation/migrations/0010_auto_20220815_1030.py new file mode 100644 index 0000000..2d3f16e --- /dev/null +++ b/compensation/migrations/0010_auto_20220815_1030.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.3 on 2022-08-15 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('compensation', '0009_auto_20220815_0803'), + ] + + operations = [ + migrations.AlterField( + model_name='compensation', + name='resubmissions', + field=models.ManyToManyField(blank=True, related_name='_compensation_resubmissions_+', to='konova.Resubmission'), + ), + migrations.AlterField( + model_name='ecoaccount', + name='resubmissions', + field=models.ManyToManyField(blank=True, related_name='_ecoaccount_resubmissions_+', to='konova.Resubmission'), + ), + ] diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py index 016f8ea..db01a04 100644 --- a/compensation/views/compensation.py +++ b/compensation/views/compensation.py @@ -14,8 +14,9 @@ from compensation.tables import CompensationTable from intervention.models import Intervention from konova.contexts import BaseContext from konova.decorators import * -from konova.forms import RemoveModalForm, SimpleGeomForm, RemoveDeadlineModalForm, EditDocumentModalForm, \ +from konova.forms.modals import RemoveModalForm,RemoveDeadlineModalForm, EditDocumentModalForm, \ ResubmissionModalForm +from konova.forms import SimpleGeomForm from konova.models import Deadline from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.utils.documents import get_document, remove_document diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py index 03109a8..2ebeb1f 100644 --- a/compensation/views/eco_account.py +++ b/compensation/views/eco_account.py @@ -25,14 +25,15 @@ 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, NewDocumentModalForm, RecordModalForm, \ +from konova.forms.modals import RemoveModalForm, RecordModalForm, \ RemoveDeadlineModalForm, EditDocumentModalForm, ResubmissionModalForm +from konova.forms import SimpleGeomForm 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 from konova.utils.documents import get_document, remove_document from konova.utils.generators import generate_qr_code -from konova.utils.message_templates import IDENTIFIER_REPLACED, FORM_INVALID, DATA_UNSHARED, DATA_UNSHARED_EXPLANATION, \ +from konova.utils.message_templates import IDENTIFIER_REPLACED, FORM_INVALID, \ CANCEL_ACC_RECORDED_OR_DEDUCTED, DEDUCTION_REMOVED, DEDUCTION_ADDED, DOCUMENT_ADDED, COMPENSATION_STATE_REMOVED, \ COMPENSATION_STATE_ADDED, COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_ADDED, DEADLINE_ADDED, DEADLINE_REMOVED, \ DEDUCTION_EDITED, DOCUMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, DEADLINE_EDITED, \ diff --git a/compensation/views/payment.py b/compensation/views/payment.py index 2be5455..84fad5b 100644 --- a/compensation/views/payment.py +++ b/compensation/views/payment.py @@ -15,7 +15,6 @@ from compensation.forms.modalForms import NewPaymentForm, RemovePaymentModalForm from compensation.models import Payment from intervention.models import Intervention from konova.decorators import default_group_required, shared_access_required -from konova.forms import RemoveModalForm from konova.utils.message_templates import PAYMENT_ADDED, PAYMENT_REMOVED, PAYMENT_EDITED diff --git a/ema/forms.py b/ema/forms.py index a7e82c4..93f2349 100644 --- a/ema/forms.py +++ b/ema/forms.py @@ -5,8 +5,6 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 06.10.21 """ -from dal import autocomplete -from django import forms from user.models import User from django.db import transaction from django.urls import reverse, reverse_lazy @@ -16,7 +14,8 @@ from compensation.forms.forms import AbstractCompensationForm, CompensationRespo PikCompensationFormMixin from ema.models import Ema, EmaDocument from intervention.models import Responsibility, Handler -from konova.forms import SimpleGeomForm, NewDocumentModalForm +from konova.forms import SimpleGeomForm +from konova.forms.modals import NewDocumentModalForm from user.models import UserActionLogEntry diff --git a/ema/migrations/0005_ema_resubmission.py b/ema/migrations/0005_ema_resubmission.py new file mode 100644 index 0000000..57a1fbe --- /dev/null +++ b/ema/migrations/0005_ema_resubmission.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('ema', '0004_ema_is_pik'), + ] + + operations = [ + migrations.AddField( + model_name='ema', + name='resubmission', + field=models.ManyToManyField(blank=True, null=True, related_name='_ema_resubmission_+', to='konova.Resubmission'), + ), + ] diff --git a/ema/migrations/0006_auto_20220815_0803.py b/ema/migrations/0006_auto_20220815_0803.py new file mode 100644 index 0000000..44ae765 --- /dev/null +++ b/ema/migrations/0006_auto_20220815_0803.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('ema', '0005_ema_resubmission'), + ] + + operations = [ + migrations.RemoveField( + model_name='ema', + name='resubmission', + ), + migrations.AddField( + model_name='ema', + name='resubmissions', + field=models.ManyToManyField(blank=True, null=True, related_name='_ema_resubmissions_+', to='konova.Resubmission'), + ), + ] diff --git a/ema/migrations/0007_auto_20220815_1030.py b/ema/migrations/0007_auto_20220815_1030.py new file mode 100644 index 0000000..8442917 --- /dev/null +++ b/ema/migrations/0007_auto_20220815_1030.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.3 on 2022-08-15 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('ema', '0006_auto_20220815_0803'), + ] + + operations = [ + migrations.AlterField( + model_name='ema', + name='resubmissions', + field=models.ManyToManyField(blank=True, related_name='_ema_resubmissions_+', to='konova.Resubmission'), + ), + ] diff --git a/ema/views.py b/ema/views.py index 9cd6dd9..f07187a 100644 --- a/ema/views.py +++ b/ema/views.py @@ -16,8 +16,9 @@ from intervention.forms.modalForms import ShareModalForm from konova.contexts import BaseContext from konova.decorators import conservation_office_group_required, shared_access_required from ema.models import Ema, EmaDocument -from konova.forms import RemoveModalForm, SimpleGeomForm, RecordModalForm, RemoveDeadlineModalForm, \ +from konova.forms.modals import RemoveModalForm, RecordModalForm, RemoveDeadlineModalForm, \ EditDocumentModalForm, ResubmissionModalForm +from konova.forms import SimpleGeomForm 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 diff --git a/intervention/forms/forms.py b/intervention/forms/forms.py index b85ba10..15b02fd 100644 --- a/intervention/forms/forms.py +++ b/intervention/forms/forms.py @@ -8,6 +8,7 @@ Created on: 02.12.20 from dal import autocomplete from django import forms +from konova.forms.base_form import BaseForm from konova.utils.message_templates import EDITED_GENERAL_DATA from user.models import User from django.db import transaction @@ -19,7 +20,7 @@ from codelist.settings import CODELIST_PROCESS_TYPE_ID, CODELIST_LAW_ID, \ CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_HANDLER_ID from intervention.inputs import GenerateInput from intervention.models import Intervention, Legal, Responsibility, Handler -from konova.forms import BaseForm, SimpleGeomForm +from konova.forms.geometry_form import SimpleGeomForm from user.models import UserActionLogEntry diff --git a/intervention/forms/modalForms.py b/intervention/forms/modalForms.py index b6445a5..a977c1c 100644 --- a/intervention/forms/modalForms.py +++ b/intervention/forms/modalForms.py @@ -19,7 +19,8 @@ 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, NewDocumentModalForm, RemoveModalForm +from konova.forms.modals import BaseModalForm +from konova.forms.modals import NewDocumentModalForm, RemoveModalForm from konova.utils.general import format_german_float from konova.utils.user_checks import is_default_group_only diff --git a/intervention/migrations/0005_intervention_resubmission.py b/intervention/migrations/0005_intervention_resubmission.py new file mode 100644 index 0000000..ac48923 --- /dev/null +++ b/intervention/migrations/0005_intervention_resubmission.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('intervention', '0004_auto_20220303_0956'), + ] + + operations = [ + migrations.AddField( + model_name='intervention', + name='resubmission', + field=models.ManyToManyField(blank=True, null=True, related_name='_intervention_resubmission_+', to='konova.Resubmission'), + ), + ] diff --git a/intervention/migrations/0006_auto_20220815_0803.py b/intervention/migrations/0006_auto_20220815_0803.py new file mode 100644 index 0000000..8d0bf80 --- /dev/null +++ b/intervention/migrations/0006_auto_20220815_0803.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('intervention', '0005_intervention_resubmission'), + ] + + operations = [ + migrations.RemoveField( + model_name='intervention', + name='resubmission', + ), + migrations.AddField( + model_name='intervention', + name='resubmissions', + field=models.ManyToManyField(blank=True, null=True, related_name='_intervention_resubmissions_+', to='konova.Resubmission'), + ), + ] diff --git a/intervention/migrations/0007_auto_20220815_1030.py b/intervention/migrations/0007_auto_20220815_1030.py new file mode 100644 index 0000000..b7a2729 --- /dev/null +++ b/intervention/migrations/0007_auto_20220815_1030.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.3 on 2022-08-15 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('konova', '0014_resubmission'), + ('intervention', '0006_auto_20220815_0803'), + ] + + operations = [ + migrations.AlterField( + model_name='intervention', + name='resubmissions', + field=models.ManyToManyField(blank=True, related_name='_intervention_resubmissions_+', to='konova.Resubmission'), + ), + ] diff --git a/intervention/views.py b/intervention/views.py index c55fe72..6a9304e 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -12,7 +12,8 @@ from intervention.models import Intervention, Revocation, InterventionDocument, from intervention.tables import InterventionTable from konova.contexts import BaseContext from konova.decorators import * -from konova.forms import SimpleGeomForm, RemoveModalForm, RecordModalForm, EditDocumentModalForm, ResubmissionModalForm +from konova.forms import SimpleGeomForm +from konova.forms.modals import RemoveModalForm, RecordModalForm, EditDocumentModalForm, ResubmissionModalForm from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.utils.documents import remove_document, get_document from konova.utils.generators import generate_qr_code diff --git a/konova/forms.py b/konova/forms.py deleted file mode 100644 index 5d8f38e..0000000 --- a/konova/forms.py +++ /dev/null @@ -1,760 +0,0 @@ -""" -Author: Michel Peltriaux -Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany -Contact: michel.peltriaux@sgdnord.rlp.de -Created on: 16.11.20 - -""" -import json -from abc import abstractmethod - -from bootstrap_modal_forms.forms import BSModalForm -from bootstrap_modal_forms.utils import is_ajax -from django import forms -from django.contrib import messages -from django.contrib.gis import gdal -from django.core.exceptions import ObjectDoesNotExist -from django.db.models.fields.files import FieldFile -from django.utils.timezone import now - -from compensation.models import EcoAccount -from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP -from user.models import User -from django.contrib.gis.forms import MultiPolygonField -from django.contrib.gis.geos import MultiPolygon, Polygon -from django.db import transaction -from django.http import HttpRequest, HttpResponseRedirect -from django.shortcuts import render -from django.utils.translation import gettext_lazy as _ - -from konova.contexts import BaseContext -from konova.models import BaseObject, Geometry, RecordableObjectMixin, AbstractDocument, Resubmission -from konova.settings import DEFAULT_SRID -from konova.tasks import celery_update_parcels -from konova.utils.message_templates import FORM_INVALID, FILE_TYPE_UNSUPPORTED, FILE_SIZE_TOO_LARGE, DOCUMENT_EDITED -from user.models import UserActionLogEntry - - -class BaseForm(forms.Form): - """ - Basic form for that holds attributes needed in all other forms - """ - template = None - action_url = None - action_btn_label = _("Save") - form_title = None - cancel_redirect = None - form_caption = None - instance = None # The data holding model object - request = None - form_attrs = {} # Holds additional attributes, that can be used in the template - has_required_fields = False # Automatically set. Triggers hint rendering in templates - show_cancel_btn = True - - def __init__(self, *args, **kwargs): - self.instance = kwargs.pop("instance", None) - super().__init__(*args, **kwargs) - if self.request is not None: - self.user = self.request.user - # Check for required fields - for _field_name, _field_val in self.fields.items(): - if _field_val.required: - self.has_required_fields = True - break - - self.check_for_recorded_instance() - - @abstractmethod - def save(self): - # To be implemented in subclasses! - pass - - def disable_form_field(self, field: str): - """ - Disables a form field for user editing - """ - self.fields[field].widget.attrs["readonly"] = True - self.fields[field].disabled = True - self.fields[field].widget.attrs["title"] = _("Not editable") - - def initialize_form_field(self, field: str, val): - """ - Initializes a form field with a value - """ - self.fields[field].initial = val - - def add_placeholder_for_field(self, field: str, val): - """ - Adds a placeholder to a field after initialization without the need to redefine the form widget - - Args: - field (str): Field name - val (str): Placeholder - - Returns: - - """ - self.fields[field].widget.attrs["placeholder"] = val - - def load_initial_data(self, form_data: dict, disabled_fields: list = None): - """ Initializes form data from instance - - Inserts instance data into form and disables form fields - - Returns: - - """ - if self.instance is None: - return - for k, v in form_data.items(): - self.initialize_form_field(k, v) - if disabled_fields: - for field in disabled_fields: - self.disable_form_field(field) - - def add_widget_html_class(self, field: str, cls: str): - """ Adds a HTML class string to the widget of a field - - Args: - field (str): The field's name - cls (str): The new class string - - Returns: - - """ - set_class = self.fields[field].widget.attrs.get("class", "") - if cls in set_class: - return - else: - set_class += " " + cls - self.fields[field].widget.attrs["class"] = set_class - - def remove_widget_html_class(self, field: str, cls: str): - """ Removes a HTML class string from the widget of a field - - Args: - field (str): The field's name - cls (str): The new class string - - Returns: - - """ - set_class = self.fields[field].widget.attrs.get("class", "") - set_class = set_class.replace(cls, "") - self.fields[field].widget.attrs["class"] = set_class - - def check_for_recorded_instance(self): - """ Checks if the instance is recorded and runs some special logic if yes - - If the instance is recorded, the form shall not display any possibility to - edit any data. Instead, the users should get some information about why they can not edit anything. - - There are situations where the form should be rendered regularly, - e.g deduction forms for (recorded) eco accounts. - - Returns: - - """ - from intervention.forms.modalForms import NewDeductionModalForm, EditEcoAccountDeductionModalForm, \ - RemoveEcoAccountDeductionModalForm - is_none = self.instance is None - is_other_data_type = not isinstance(self.instance, BaseObject) - is_deduction_form_from_account = isinstance( - self, - ( - NewDeductionModalForm, - ResubmissionModalForm, - EditEcoAccountDeductionModalForm, - RemoveEcoAccountDeductionModalForm, - ) - ) and isinstance(self.instance, EcoAccount) - - if is_none or is_other_data_type or is_deduction_form_from_account: - # Do nothing - return - - if self.instance.is_recorded: - self.template = "form/recorded_no_edit.html" - - -class RemoveForm(BaseForm): - check = forms.BooleanField( - label=_("Confirm"), - label_suffix=_(""), - required=True, - ) - - def __init__(self, *args, **kwargs): - self.object_to_remove = kwargs.pop("object_to_remove", None) - self.remove_post_url = kwargs.pop("remove_post_url", "") - self.cancel_url = kwargs.pop("cancel_url", "") - - super().__init__(*args, **kwargs) - - self.form_title = _("Remove") - if self.object_to_remove is not None: - self.form_caption = _("You are about to remove {} {}").format(self.object_to_remove.__class__.__name__, self.object_to_remove) - self.action_url = self.remove_post_url - self.cancel_redirect = self.cancel_url - - def is_checked(self) -> bool: - return self.cleaned_data.get("check", False) - - def save(self, user: User): - """ Perform generic removing by running the form typical 'save()' method - - Args: - user (User): The performing user - - Returns: - - """ - if self.object_to_remove is not None and self.is_checked(): - with transaction.atomic(): - self.object_to_remove.is_active = False - action = UserActionLogEntry.get_deleted_action(user) - self.object_to_remove.deleted = action - self.object_to_remove.save() - return self.object_to_remove - - -class BaseModalForm(BaseForm, BSModalForm): - """ A specialzed form class for modal form handling - - """ - is_modal_form = True - render_submit = True - template = "modal/modal_form.html" - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.action_btn_label = _("Continue") - - def process_request(self, request: HttpRequest, msg_success: str = _("Object removed"), msg_error: str = FORM_INVALID, redirect_url: str = None): - """ Generic processing of request - - Wraps the request processing logic, so we don't need the same code everywhere a RemoveModalForm is being used - - Args: - request (HttpRequest): The incoming request - msg_success (str): The message in case of successful removing - msg_error (str): The message in case of an error - - Returns: - - """ - redirect_url = redirect_url if redirect_url is not None else request.META.get("HTTP_REFERER", "home") - template = self.template - if request.method == "POST": - if self.is_valid(): - if not is_ajax(request.META): - # Modal forms send one POST for checking on data validity. This can be used to return possible errors - # on the form. A second POST (if no errors occured) is sent afterwards and needs to process the - # saving/commiting of the data to the database. is_ajax() performs this check. The first request is - # an ajax call, the second is a regular form POST. - self.save() - messages.success( - request, - msg_success - ) - return HttpResponseRedirect(redirect_url) - else: - context = { - "form": self, - } - context = BaseContext(request, context).context - return render(request, template, context) - elif request.method == "GET": - context = { - "form": self, - } - context = BaseContext(request, context).context - return render(request, template, context) - else: - raise NotImplementedError - - -class SimpleGeomForm(BaseForm): - """ A geometry form for rendering geometry read-only using a widget - - """ - read_only = True - geom = MultiPolygonField( - srid=DEFAULT_SRID_RLP, - label=_("Geometry"), - help_text=_(""), - label_suffix="", - required=False, - disabled=False, - ) - - def __init__(self, *args, **kwargs): - self.read_only = kwargs.pop("read_only", True) - super().__init__(*args, **kwargs) - - # Initialize geometry - try: - geom = self.instance.geometry.geom - self.empty = geom.empty - - if self.empty: - raise AttributeError - - geojson = self.instance.geometry.as_feature_collection(srid=DEFAULT_SRID_RLP) - geom = json.dumps(geojson) - except AttributeError: - # If no geometry exists for this form, we simply set the value to None and zoom to the maximum level - geom = "" - self.empty = True - - self.initialize_form_field("geom", geom) - - def is_valid(self): - super().is_valid() - is_valid = True - - # Get geojson from form - geom = self.data["geom"] - if geom is None or len(geom) == 0: - # empty geometry is a valid geometry - return is_valid - geom = json.loads(geom) - - # Write submitted data back into form field to make sure invalid geometry - # will be rendered again on failed submit - self.initialize_form_field("geom", self.data["geom"]) - - # Read geojson into gdal geometry - # HINT: This can be simplified if the geojson format holds data in epsg:4326 (GDAL provides direct creation for - # this case) - features = [] - features_json = geom.get("features", []) - for feature in features_json: - g = gdal.OGRGeometry(json.dumps(feature.get("geometry", feature)), srs=DEFAULT_SRID_RLP) - if g.geom_type not in ["Polygon", "MultiPolygon"]: - self.add_error("geom", _("Only surfaces allowed. Points or lines must be buffered.")) - is_valid = False - return is_valid - - polygon = Polygon.from_ewkt(g.ewkt) - is_valid = polygon.valid - if not is_valid: - self.add_error("geom", polygon.valid_reason) - return is_valid - - features.append(polygon) - form_geom = MultiPolygon(srid=DEFAULT_SRID_RLP) - for feature in features: - form_geom = form_geom.union(feature) - - # Make sure to convert into a MultiPolygon. Relevant if a single Polygon is provided. - if form_geom.geom_type != "MultiPolygon": - form_geom = MultiPolygon(form_geom, srid=DEFAULT_SRID_RLP) - - # Write unioned Multipolygon into cleaned data - if self.cleaned_data is None: - self.cleaned_data = {} - self.cleaned_data["geom"] = form_geom.ewkt - - return is_valid - - def save(self, action: UserActionLogEntry): - """ Saves the form's geometry - - Creates a new geometry entry if none is set, yet - - Args: - action (): - - Returns: - - """ - try: - if self.instance is None or self.instance.geometry is None: - raise LookupError - geometry = self.instance.geometry - geometry.geom = self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID_RLP)) - geometry.modified = action - - geometry.save() - except LookupError: - # No geometry or linked instance holding a geometry exist --> create a new one! - geometry = Geometry.objects.create( - geom=self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID_RLP)), - created=action, - ) - # Start the parcel update procedure in a background process - celery_update_parcels.delay(geometry.id) - return geometry - - -class RemoveModalForm(BaseModalForm): - """ Generic removing modal form - - Can be used for anything, where removing shall be confirmed by the user a second time. - - """ - confirm = forms.BooleanField( - label=_("Confirm"), - label_suffix=_(""), - widget=forms.CheckboxInput(), - required=True, - ) - - def __init__(self, *args, **kwargs): - self.template = "modal/modal_form.html" - super().__init__(*args, **kwargs) - self.form_title = _("Remove") - self.form_caption = _("Are you sure?") - # Disable automatic w-100 setting for this type of modal form. Looks kinda strange - self.fields["confirm"].widget.attrs["class"] = "" - - def save(self): - if isinstance(self.instance, BaseObject): - self.instance.mark_as_deleted(self.user) - else: - # If the class does not provide restorable delete functionality, we must delete the entry finally - self.instance.delete() - - -class RemoveDeadlineModalForm(RemoveModalForm): - """ Removing modal form for deadlines - - Can be used for anything, where removing shall be confirmed by the user a second time. - - """ - deadline = None - - def __init__(self, *args, **kwargs): - deadline = kwargs.pop("deadline", None) - self.deadline = deadline - super().__init__(*args, **kwargs) - - def save(self): - self.instance.remove_deadline(self) - - -class NewDocumentModalForm(BaseModalForm): - """ Modal form for new documents - - """ - title = forms.CharField( - label=_("Title"), - label_suffix=_(""), - max_length=500, - widget=forms.TextInput( - attrs={ - "class": "form-control", - } - ) - ) - creation_date = forms.DateField( - label=_("Created on"), - label_suffix=_(""), - help_text=_("When has this file been created? Important for photos."), - widget=forms.DateInput( - attrs={ - "type": "date", - "data-provide": "datepicker", - "class": "form-control", - }, - format="%d.%m.%Y" - ) - ) - file = forms.FileField( - label=_("File"), - label_suffix=_(""), - help_text=_("Allowed formats: pdf, jpg, png. Max size 15 MB."), - widget=forms.FileInput( - attrs={ - "class": "form-control-file", - } - ), - ) - comment = forms.CharField( - required=False, - max_length=200, - label=_("Comment"), - label_suffix=_(""), - help_text=_("Additional comment, maximum {} letters").format(200), - widget=forms.Textarea( - attrs={ - "cols": 30, - "rows": 5, - "class": "form-control", - } - ) - ) - document_model = None - - class Meta: - abstract = True - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.form_title = _("Add new document") - self.form_caption = _("") - self.form_attrs = { - "enctype": "multipart/form-data", # important for file upload - } - if not self.document_model: - raise NotImplementedError("Unsupported document type for {}".format(self.instance.__class__)) - - def is_valid(self): - super_valid = super().is_valid() - - _file = self.cleaned_data.get("file", None) - - if _file is None or 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): - with transaction.atomic(): - action = UserActionLogEntry.get_created_action(self.user) - edited_action = UserActionLogEntry.get_edited_action(self.user, _("Added document")) - - doc = self.document_model.objects.create( - created=action, - title=self.cleaned_data["title"], - comment=self.cleaned_data["comment"], - file=self.cleaned_data["file"], - date_of_creation=self.cleaned_data["creation_date"], - instance=self.instance, - ) - - self.instance.log.add(edited_action) - self.instance.modified = edited_action - self.instance.save() - - return doc - - -class EditDocumentModalForm(NewDocumentModalForm): - document = None - document_model = AbstractDocument - - def __init__(self, *args, **kwargs): - self.document = kwargs.pop("document", None) - super().__init__(*args, **kwargs) - self.form_title = _("Edit document") - form_data = { - "title": self.document.title, - "comment": self.document.comment, - "creation_date": str(self.document.date_of_creation), - "file": self.document.file, - } - self.load_initial_data(form_data) - - - def save(self): - with transaction.atomic(): - document = self.document - file = self.cleaned_data.get("file", None) - - document.title = self.cleaned_data.get("title", None) - document.comment = self.cleaned_data.get("comment", None) - document.date_of_creation = self.cleaned_data.get("creation_date", None) - if not isinstance(file, FieldFile): - document.replace_file(file) - document.save() - - self.instance.mark_as_edited(self.user, self.request, edit_comment=DOCUMENT_EDITED) - - return document - - -class RecordModalForm(BaseModalForm): - """ Modal form for recording data - - """ - confirm = forms.BooleanField( - label=_("Confirm record"), - label_suffix="", - widget=forms.CheckboxInput(), - required=True, - ) - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.form_title = _("Record data") - self.form_caption = _("I, {} {}, confirm that all necessary control steps have been performed by myself.").format(self.user.first_name, self.user.last_name) - # Disable automatic w-100 setting for this type of modal form. Looks kinda strange - self.fields["confirm"].widget.attrs["class"] = "" - - if self.instance.recorded: - # unrecord! - self.fields["confirm"].label = _("Confirm unrecord") - self.form_title = _("Unrecord data") - self.form_caption = _("I, {} {}, confirm that this data must be unrecorded.").format(self.user.first_name, self.user.last_name) - - if not isinstance(self.instance, RecordableObjectMixin): - raise NotImplementedError - - def is_valid(self): - """ Checks for instance's validity and data quality - - Returns: - - """ - from intervention.models import Intervention - super_val = super().is_valid() - if self.instance.recorded: - # If user wants to unrecord an already recorded dataset, we do not need to perform custom checks - return super_val - checker = self.instance.quality_check() - for msg in checker.messages: - self.add_error( - "confirm", - msg - ) - valid = checker.valid - # Special case: Intervention - # Add direct checks for related compensations - if isinstance(self.instance, Intervention): - comps_valid = self._are_compensations_valid() - valid = valid and comps_valid - return super_val and valid - - def _are_deductions_valid(self): - """ Performs validity checks on deductions and their eco-account - - Returns: - - """ - deductions = self.instance.deductions.all() - for deduction in deductions: - checker = deduction.account.quality_check() - for msg in checker.messages: - self.add_error( - "confirm", - f"{deduction.account.identifier}: {msg}" - ) - return checker.valid - return True - - def _are_compensations_valid(self): - """ Runs a special case for intervention-compensations validity - - Returns: - - """ - comps = self.instance.compensations.filter( - deleted=None, - ) - comps_valid = True - for comp in comps: - checker = comp.quality_check() - comps_valid = comps_valid and checker.valid - for msg in checker.messages: - self.add_error( - "confirm", - f"{comp.identifier}: {msg}" - ) - - deductions_valid = self._are_deductions_valid() - - return comps_valid and deductions_valid - - def save(self): - with transaction.atomic(): - if self.cleaned_data["confirm"]: - if self.instance.recorded: - self.instance.set_unrecorded(self.user) - else: - self.instance.set_recorded(self.user) - return self.instance - - def check_for_recorded_instance(self): - """ Overwrite the check method for doing nothing on the RecordModalForm - - Returns: - - """ - pass - - -class ResubmissionModalForm(BaseModalForm): - date = forms.DateField( - label_suffix=_(""), - label=_("Date"), - help_text=_("When do you want to be reminded?"), - widget=forms.DateInput( - attrs={ - "type": "date", - "data-provide": "datepicker", - "class": "form-control", - }, - format="%d.%m.%Y" - ) - ) - comment = forms.CharField( - required=False, - label=_("Comment"), - label_suffix=_(""), - help_text=_("Additional comment"), - widget=forms.Textarea( - attrs={ - "cols": 30, - "rows": 5, - "class": "form-control", - } - ) - ) - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.form_title = _("Resubmission") - self.form_caption = _("Set your resubmission for this entry.") - self.action_url = None - - try: - self.resubmission = self.instance.resubmissions.get( - user=self.user - ) - self.initialize_form_field("date", str(self.resubmission.resubmit_on)) - self.initialize_form_field("comment", self.resubmission.comment) - except ObjectDoesNotExist: - self.resubmission = Resubmission() - - def is_valid(self): - super_valid = super().is_valid() - self_valid = True - - date = self.cleaned_data.get("date") - today = now().today().date() - if date <= today: - self.add_error( - "date", - _("The date should be in the future") - ) - self_valid = False - - return super_valid and self_valid - - def save(self): - with transaction.atomic(): - self.resubmission.user = self.user - self.resubmission.resubmit_on = self.cleaned_data.get("date") - self.resubmission.comment = self.cleaned_data.get("comment") - self.resubmission.save() - self.instance.resubmissions.add(self.resubmission) - return self.resubmission - diff --git a/konova/forms/__init__.py b/konova/forms/__init__.py new file mode 100644 index 0000000..5840c4d --- /dev/null +++ b/konova/forms/__init__.py @@ -0,0 +1,11 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" + +from .base_form import * +from .geometry_form import * +from .remove_form import * \ No newline at end of file diff --git a/konova/forms/base_form.py b/konova/forms/base_form.py new file mode 100644 index 0000000..065fba1 --- /dev/null +++ b/konova/forms/base_form.py @@ -0,0 +1,157 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from abc import abstractmethod + +from django import forms +from django.utils.translation import gettext_lazy as _ + +from compensation.models import EcoAccount +from konova.models import BaseObject + + +class BaseForm(forms.Form): + """ + Basic form for that holds attributes needed in all other forms + """ + template = None + action_url = None + action_btn_label = _("Save") + form_title = None + cancel_redirect = None + form_caption = None + instance = None # The data holding model object + request = None + form_attrs = {} # Holds additional attributes, that can be used in the template + has_required_fields = False # Automatically set. Triggers hint rendering in templates + show_cancel_btn = True + + def __init__(self, *args, **kwargs): + self.instance = kwargs.pop("instance", None) + super().__init__(*args, **kwargs) + if self.request is not None: + self.user = self.request.user + # Check for required fields + for _field_name, _field_val in self.fields.items(): + if _field_val.required: + self.has_required_fields = True + break + + self.check_for_recorded_instance() + + @abstractmethod + def save(self): + # To be implemented in subclasses! + pass + + def disable_form_field(self, field: str): + """ + Disables a form field for user editing + """ + self.fields[field].widget.attrs["readonly"] = True + self.fields[field].disabled = True + self.fields[field].widget.attrs["title"] = _("Not editable") + + def initialize_form_field(self, field: str, val): + """ + Initializes a form field with a value + """ + self.fields[field].initial = val + + def add_placeholder_for_field(self, field: str, val): + """ + Adds a placeholder to a field after initialization without the need to redefine the form widget + + Args: + field (str): Field name + val (str): Placeholder + + Returns: + + """ + self.fields[field].widget.attrs["placeholder"] = val + + def load_initial_data(self, form_data: dict, disabled_fields: list = None): + """ Initializes form data from instance + + Inserts instance data into form and disables form fields + + Returns: + + """ + if self.instance is None: + return + for k, v in form_data.items(): + self.initialize_form_field(k, v) + if disabled_fields: + for field in disabled_fields: + self.disable_form_field(field) + + def add_widget_html_class(self, field: str, cls: str): + """ Adds a HTML class string to the widget of a field + + Args: + field (str): The field's name + cls (str): The new class string + + Returns: + + """ + set_class = self.fields[field].widget.attrs.get("class", "") + if cls in set_class: + return + else: + set_class += " " + cls + self.fields[field].widget.attrs["class"] = set_class + + def remove_widget_html_class(self, field: str, cls: str): + """ Removes a HTML class string from the widget of a field + + Args: + field (str): The field's name + cls (str): The new class string + + Returns: + + """ + set_class = self.fields[field].widget.attrs.get("class", "") + set_class = set_class.replace(cls, "") + self.fields[field].widget.attrs["class"] = set_class + + def check_for_recorded_instance(self): + """ Checks if the instance is recorded and runs some special logic if yes + + If the instance is recorded, the form shall not display any possibility to + edit any data. Instead, the users should get some information about why they can not edit anything. + + There are situations where the form should be rendered regularly, + e.g deduction forms for (recorded) eco accounts. + + Returns: + + """ + from intervention.forms.modalForms import NewDeductionModalForm, EditEcoAccountDeductionModalForm, \ + RemoveEcoAccountDeductionModalForm + from konova.forms.modals.resubmission_form import ResubmissionModalForm + is_none = self.instance is None + is_other_data_type = not isinstance(self.instance, BaseObject) + is_deduction_form_from_account = isinstance( + self, + ( + NewDeductionModalForm, + ResubmissionModalForm, + EditEcoAccountDeductionModalForm, + RemoveEcoAccountDeductionModalForm, + ) + ) and isinstance(self.instance, EcoAccount) + + if is_none or is_other_data_type or is_deduction_form_from_account: + # Do nothing + return + + if self.instance.is_recorded: + self.template = "form/recorded_no_edit.html" diff --git a/konova/forms/geometry_form.py b/konova/forms/geometry_form.py new file mode 100644 index 0000000..3c957aa --- /dev/null +++ b/konova/forms/geometry_form.py @@ -0,0 +1,133 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +import json + +from django.contrib.gis import gdal +from django.contrib.gis.forms import MultiPolygonField +from django.contrib.gis.geos import MultiPolygon, Polygon +from django.utils.translation import gettext_lazy as _ + +from konova.forms.base_form import BaseForm +from konova.models import Geometry +from konova.tasks import celery_update_parcels +from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP +from user.models import UserActionLogEntry + + +class SimpleGeomForm(BaseForm): + """ A geometry form for rendering geometry read-only using a widget + + """ + read_only = True + geom = MultiPolygonField( + srid=DEFAULT_SRID_RLP, + label=_("Geometry"), + help_text=_(""), + label_suffix="", + required=False, + disabled=False, + ) + + def __init__(self, *args, **kwargs): + self.read_only = kwargs.pop("read_only", True) + super().__init__(*args, **kwargs) + + # Initialize geometry + try: + geom = self.instance.geometry.geom + self.empty = geom.empty + + if self.empty: + raise AttributeError + + geojson = self.instance.geometry.as_feature_collection(srid=DEFAULT_SRID_RLP) + geom = json.dumps(geojson) + except AttributeError: + # If no geometry exists for this form, we simply set the value to None and zoom to the maximum level + geom = "" + self.empty = True + + self.initialize_form_field("geom", geom) + + def is_valid(self): + super().is_valid() + is_valid = True + + # Get geojson from form + geom = self.data["geom"] + if geom is None or len(geom) == 0: + # empty geometry is a valid geometry + return is_valid + geom = json.loads(geom) + + # Write submitted data back into form field to make sure invalid geometry + # will be rendered again on failed submit + self.initialize_form_field("geom", self.data["geom"]) + + # Read geojson into gdal geometry + # HINT: This can be simplified if the geojson format holds data in epsg:4326 (GDAL provides direct creation for + # this case) + features = [] + features_json = geom.get("features", []) + for feature in features_json: + g = gdal.OGRGeometry(json.dumps(feature.get("geometry", feature)), srs=DEFAULT_SRID_RLP) + if g.geom_type not in ["Polygon", "MultiPolygon"]: + self.add_error("geom", _("Only surfaces allowed. Points or lines must be buffered.")) + is_valid = False + return is_valid + + polygon = Polygon.from_ewkt(g.ewkt) + is_valid = polygon.valid + if not is_valid: + self.add_error("geom", polygon.valid_reason) + return is_valid + + features.append(polygon) + form_geom = MultiPolygon(srid=DEFAULT_SRID_RLP) + for feature in features: + form_geom = form_geom.union(feature) + + # Make sure to convert into a MultiPolygon. Relevant if a single Polygon is provided. + if form_geom.geom_type != "MultiPolygon": + form_geom = MultiPolygon(form_geom, srid=DEFAULT_SRID_RLP) + + # Write unioned Multipolygon into cleaned data + if self.cleaned_data is None: + self.cleaned_data = {} + self.cleaned_data["geom"] = form_geom.ewkt + + return is_valid + + def save(self, action: UserActionLogEntry): + """ Saves the form's geometry + + Creates a new geometry entry if none is set, yet + + Args: + action (): + + Returns: + + """ + try: + if self.instance is None or self.instance.geometry is None: + raise LookupError + geometry = self.instance.geometry + geometry.geom = self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID_RLP)) + geometry.modified = action + + geometry.save() + except LookupError: + # No geometry or linked instance holding a geometry exist --> create a new one! + geometry = Geometry.objects.create( + geom=self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID_RLP)), + created=action, + ) + # Start the parcel update procedure in a background process + celery_update_parcels.delay(geometry.id) + return geometry \ No newline at end of file diff --git a/konova/forms/modals/__init__.py b/konova/forms/modals/__init__.py new file mode 100644 index 0000000..f922f2d --- /dev/null +++ b/konova/forms/modals/__init__.py @@ -0,0 +1,12 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from .base_form import * +from .document_form import * +from .record_form import * +from .remove_form import * +from .resubmission_form import * diff --git a/konova/forms/modals/base_form.py b/konova/forms/modals/base_form.py new file mode 100644 index 0000000..a680657 --- /dev/null +++ b/konova/forms/modals/base_form.py @@ -0,0 +1,73 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from bootstrap_modal_forms.forms import BSModalForm +from bootstrap_modal_forms.utils import is_ajax +from django.contrib import messages +from django.http import HttpResponseRedirect, HttpRequest +from django.shortcuts import render +from django.utils.translation import gettext_lazy as _ + +from konova.contexts import BaseContext +from konova.forms.base_form import BaseForm +from konova.utils.message_templates import FORM_INVALID + + +class BaseModalForm(BaseForm, BSModalForm): + """ A specialzed form class for modal form handling + + """ + is_modal_form = True + render_submit = True + template = "modal/modal_form.html" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.action_btn_label = _("Continue") + + def process_request(self, request: HttpRequest, msg_success: str = _("Object removed"), msg_error: str = FORM_INVALID, redirect_url: str = None): + """ Generic processing of request + + Wraps the request processing logic, so we don't need the same code everywhere a RemoveModalForm is being used + + Args: + request (HttpRequest): The incoming request + msg_success (str): The message in case of successful removing + msg_error (str): The message in case of an error + + Returns: + + """ + redirect_url = redirect_url if redirect_url is not None else request.META.get("HTTP_REFERER", "home") + template = self.template + if request.method == "POST": + if self.is_valid(): + if not is_ajax(request.META): + # Modal forms send one POST for checking on data validity. This can be used to return possible errors + # on the form. A second POST (if no errors occured) is sent afterwards and needs to process the + # saving/commiting of the data to the database. is_ajax() performs this check. The first request is + # an ajax call, the second is a regular form POST. + self.save() + messages.success( + request, + msg_success + ) + return HttpResponseRedirect(redirect_url) + else: + context = { + "form": self, + } + context = BaseContext(request, context).context + return render(request, template, context) + elif request.method == "GET": + context = { + "form": self, + } + context = BaseContext(request, context).context + return render(request, template, context) + else: + raise NotImplementedError diff --git a/konova/forms/modals/document_form.py b/konova/forms/modals/document_form.py new file mode 100644 index 0000000..96b4f8e --- /dev/null +++ b/konova/forms/modals/document_form.py @@ -0,0 +1,163 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from django import forms +from django.db import transaction +from django.db.models.fields.files import FieldFile +from django.utils.translation import gettext_lazy as _ + +from konova.forms.modals.base_form import BaseModalForm +from konova.models import AbstractDocument +from konova.utils.message_templates import DOCUMENT_EDITED, FILE_SIZE_TOO_LARGE, FILE_TYPE_UNSUPPORTED +from user.models import UserActionLogEntry + + +class NewDocumentModalForm(BaseModalForm): + """ Modal form for new documents + + """ + title = forms.CharField( + label=_("Title"), + label_suffix=_(""), + max_length=500, + widget=forms.TextInput( + attrs={ + "class": "form-control", + } + ) + ) + creation_date = forms.DateField( + label=_("Created on"), + label_suffix=_(""), + help_text=_("When has this file been created? Important for photos."), + widget=forms.DateInput( + attrs={ + "type": "date", + "data-provide": "datepicker", + "class": "form-control", + }, + format="%d.%m.%Y" + ) + ) + file = forms.FileField( + label=_("File"), + label_suffix=_(""), + help_text=_("Allowed formats: pdf, jpg, png. Max size 15 MB."), + widget=forms.FileInput( + attrs={ + "class": "form-control-file", + } + ), + ) + comment = forms.CharField( + required=False, + max_length=200, + label=_("Comment"), + label_suffix=_(""), + help_text=_("Additional comment, maximum {} letters").format(200), + widget=forms.Textarea( + attrs={ + "cols": 30, + "rows": 5, + "class": "form-control", + } + ) + ) + document_model = None + + class Meta: + abstract = True + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.form_title = _("Add new document") + self.form_caption = _("") + self.form_attrs = { + "enctype": "multipart/form-data", # important for file upload + } + if not self.document_model: + raise NotImplementedError("Unsupported document type for {}".format(self.instance.__class__)) + + def is_valid(self): + super_valid = super().is_valid() + + _file = self.cleaned_data.get("file", None) + + if _file is None or 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): + with transaction.atomic(): + action = UserActionLogEntry.get_created_action(self.user) + edited_action = UserActionLogEntry.get_edited_action(self.user, _("Added document")) + + doc = self.document_model.objects.create( + created=action, + title=self.cleaned_data["title"], + comment=self.cleaned_data["comment"], + file=self.cleaned_data["file"], + date_of_creation=self.cleaned_data["creation_date"], + instance=self.instance, + ) + + self.instance.log.add(edited_action) + self.instance.modified = edited_action + self.instance.save() + + return doc + + +class EditDocumentModalForm(NewDocumentModalForm): + document = None + document_model = AbstractDocument + + def __init__(self, *args, **kwargs): + self.document = kwargs.pop("document", None) + super().__init__(*args, **kwargs) + self.form_title = _("Edit document") + form_data = { + "title": self.document.title, + "comment": self.document.comment, + "creation_date": str(self.document.date_of_creation), + "file": self.document.file, + } + self.load_initial_data(form_data) + + def save(self): + with transaction.atomic(): + document = self.document + file = self.cleaned_data.get("file", None) + + document.title = self.cleaned_data.get("title", None) + document.comment = self.cleaned_data.get("comment", None) + document.date_of_creation = self.cleaned_data.get("creation_date", None) + if not isinstance(file, FieldFile): + document.replace_file(file) + document.save() + + self.instance.mark_as_edited(self.user, self.request, edit_comment=DOCUMENT_EDITED) + + return document + diff --git a/konova/forms/modals/record_form.py b/konova/forms/modals/record_form.py new file mode 100644 index 0000000..812b697 --- /dev/null +++ b/konova/forms/modals/record_form.py @@ -0,0 +1,123 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from django import forms +from django.db import transaction +from django.utils.translation import gettext_lazy as _ + +from konova.forms.modals.base_form import BaseModalForm +from konova.models import RecordableObjectMixin + + +class RecordModalForm(BaseModalForm): + """ Modal form for recording data + + """ + confirm = forms.BooleanField( + label=_("Confirm record"), + label_suffix="", + widget=forms.CheckboxInput(), + required=True, + ) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.form_title = _("Record data") + self.form_caption = _("I, {} {}, confirm that all necessary control steps have been performed by myself.").format(self.user.first_name, self.user.last_name) + # Disable automatic w-100 setting for this type of modal form. Looks kinda strange + self.fields["confirm"].widget.attrs["class"] = "" + + if self.instance.recorded: + # unrecord! + self.fields["confirm"].label = _("Confirm unrecord") + self.form_title = _("Unrecord data") + self.form_caption = _("I, {} {}, confirm that this data must be unrecorded.").format(self.user.first_name, self.user.last_name) + + if not isinstance(self.instance, RecordableObjectMixin): + raise NotImplementedError + + def is_valid(self): + """ Checks for instance's validity and data quality + + Returns: + + """ + from intervention.models import Intervention + super_val = super().is_valid() + if self.instance.recorded: + # If user wants to unrecord an already recorded dataset, we do not need to perform custom checks + return super_val + checker = self.instance.quality_check() + for msg in checker.messages: + self.add_error( + "confirm", + msg + ) + valid = checker.valid + # Special case: Intervention + # Add direct checks for related compensations + if isinstance(self.instance, Intervention): + comps_valid = self._are_compensations_valid() + valid = valid and comps_valid + return super_val and valid + + def _are_deductions_valid(self): + """ Performs validity checks on deductions and their eco-account + + Returns: + + """ + deductions = self.instance.deductions.all() + for deduction in deductions: + checker = deduction.account.quality_check() + for msg in checker.messages: + self.add_error( + "confirm", + f"{deduction.account.identifier}: {msg}" + ) + return checker.valid + return True + + def _are_compensations_valid(self): + """ Runs a special case for intervention-compensations validity + + Returns: + + """ + comps = self.instance.compensations.filter( + deleted=None, + ) + comps_valid = True + for comp in comps: + checker = comp.quality_check() + comps_valid = comps_valid and checker.valid + for msg in checker.messages: + self.add_error( + "confirm", + f"{comp.identifier}: {msg}" + ) + + deductions_valid = self._are_deductions_valid() + + return comps_valid and deductions_valid + + def save(self): + with transaction.atomic(): + if self.cleaned_data["confirm"]: + if self.instance.recorded: + self.instance.set_unrecorded(self.user) + else: + self.instance.set_recorded(self.user) + return self.instance + + def check_for_recorded_instance(self): + """ Overwrite the check method for doing nothing on the RecordModalForm + + Returns: + + """ + pass diff --git a/konova/forms/modals/remove_form.py b/konova/forms/modals/remove_form.py new file mode 100644 index 0000000..7a14626 --- /dev/null +++ b/konova/forms/modals/remove_form.py @@ -0,0 +1,58 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from django import forms +from django.utils.translation import gettext_lazy as _ + +from konova.forms.modals.base_form import BaseModalForm +from konova.models import BaseObject + + +class RemoveModalForm(BaseModalForm): + """ Generic removing modal form + + Can be used for anything, where removing shall be confirmed by the user a second time. + + """ + confirm = forms.BooleanField( + label=_("Confirm"), + label_suffix=_(""), + widget=forms.CheckboxInput(), + required=True, + ) + + def __init__(self, *args, **kwargs): + self.template = "modal/modal_form.html" + super().__init__(*args, **kwargs) + self.form_title = _("Remove") + self.form_caption = _("Are you sure?") + # Disable automatic w-100 setting for this type of modal form. Looks kinda strange + self.fields["confirm"].widget.attrs["class"] = "" + + def save(self): + if isinstance(self.instance, BaseObject): + self.instance.mark_as_deleted(self.user) + else: + # If the class does not provide restorable delete functionality, we must delete the entry finally + self.instance.delete() + + +class RemoveDeadlineModalForm(RemoveModalForm): + """ Removing modal form for deadlines + + Can be used for anything, where removing shall be confirmed by the user a second time. + + """ + deadline = None + + def __init__(self, *args, **kwargs): + deadline = kwargs.pop("deadline", None) + self.deadline = deadline + super().__init__(*args, **kwargs) + + def save(self): + self.instance.remove_deadline(self) \ No newline at end of file diff --git a/konova/forms/modals/resubmission_form.py b/konova/forms/modals/resubmission_form.py new file mode 100644 index 0000000..d1d846f --- /dev/null +++ b/konova/forms/modals/resubmission_form.py @@ -0,0 +1,85 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +import datetime + +from django import forms +from django.core.exceptions import ObjectDoesNotExist +from django.db import transaction +from django.utils.translation import gettext_lazy as _ + +from konova.forms.modals.base_form import BaseModalForm +from konova.models import Resubmission + + +class ResubmissionModalForm(BaseModalForm): + date = forms.DateField( + label_suffix=_(""), + label=_("Date"), + help_text=_("When do you want to be reminded?"), + widget=forms.DateInput( + attrs={ + "type": "date", + "data-provide": "datepicker", + "class": "form-control", + }, + format="%d.%m.%Y" + ) + ) + comment = forms.CharField( + required=False, + label=_("Comment"), + label_suffix=_(""), + help_text=_("Additional comment"), + widget=forms.Textarea( + attrs={ + "cols": 30, + "rows": 5, + "class": "form-control", + } + ) + ) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.form_title = _("Resubmission") + self.form_caption = _("Set your resubmission for this entry.") + self.action_url = None + + try: + self.resubmission = self.instance.resubmissions.get( + user=self.user + ) + self.initialize_form_field("date", str(self.resubmission.resubmit_on)) + self.initialize_form_field("comment", self.resubmission.comment) + except ObjectDoesNotExist: + self.resubmission = Resubmission() + + def is_valid(self): + super_valid = super().is_valid() + self_valid = True + + date = self.cleaned_data.get("date") + today = datetime.date.today() + if date <= today: + self.add_error( + "date", + _("The date should be in the future") + ) + self_valid = False + + return super_valid and self_valid + + def save(self): + with transaction.atomic(): + self.resubmission.user = self.user + self.resubmission.resubmit_on = self.cleaned_data.get("date") + self.resubmission.comment = self.cleaned_data.get("comment") + self.resubmission.save() + self.instance.resubmissions.add(self.resubmission) + return self.resubmission + diff --git a/konova/forms/remove_form.py b/konova/forms/remove_form.py new file mode 100644 index 0000000..d5c884a --- /dev/null +++ b/konova/forms/remove_form.py @@ -0,0 +1,54 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: ksp-servicestelle@sgdnord.rlp.de +Created on: 15.08.22 + +""" +from django import forms +from django.db import transaction +from django.utils.translation import gettext_lazy as _ + +from konova.forms.base_form import BaseForm +from user.models import UserActionLogEntry, User + + +class RemoveForm(BaseForm): + check = forms.BooleanField( + label=_("Confirm"), + label_suffix=_(""), + required=True, + ) + + def __init__(self, *args, **kwargs): + self.object_to_remove = kwargs.pop("object_to_remove", None) + self.remove_post_url = kwargs.pop("remove_post_url", "") + self.cancel_url = kwargs.pop("cancel_url", "") + + super().__init__(*args, **kwargs) + + self.form_title = _("Remove") + if self.object_to_remove is not None: + self.form_caption = _("You are about to remove {} {}").format(self.object_to_remove.__class__.__name__, self.object_to_remove) + self.action_url = self.remove_post_url + self.cancel_redirect = self.cancel_url + + def is_checked(self) -> bool: + return self.cleaned_data.get("check", False) + + def save(self, user: User): + """ Perform generic removing by running the form typical 'save()' method + + Args: + user (User): The performing user + + Returns: + + """ + if self.object_to_remove is not None and self.is_checked(): + with transaction.atomic(): + self.object_to_remove.is_active = False + action = UserActionLogEntry.get_deleted_action(user) + self.object_to_remove.deleted = action + self.object_to_remove.save() + return self.object_to_remove diff --git a/konova/migrations/0005_auto_20220216_0856.py b/konova/migrations/0005_auto_20220216_0856.py index 567e206..8626b7c 100644 --- a/konova/migrations/0005_auto_20220216_0856.py +++ b/konova/migrations/0005_auto_20220216_0856.py @@ -33,6 +33,7 @@ class Migration(migrations.Migration): dependencies = [ ('konova', '0004_auto_20220209_0839'), + ('compensation', '0002_auto_20220114_0936'), ] operations = [ diff --git a/konova/migrations/0014_resubmission.py b/konova/migrations/0014_resubmission.py new file mode 100644 index 0000000..f0ef9e7 --- /dev/null +++ b/konova/migrations/0014_resubmission.py @@ -0,0 +1,33 @@ +# Generated by Django 3.1.3 on 2022-08-15 06:03 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('user', '0006_auto_20220815_0759'), + ('konova', '0013_auto_20220713_0814'), + ] + + operations = [ + migrations.CreateModel( + name='Resubmission', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('resubmit_on', models.DateField(help_text='On which date the resubmission should be performed')), + ('resubmission_sent', models.BooleanField(default=False, help_text='Whether a resubmission has been sent or not')), + ('comment', models.TextField(blank=True, help_text='Optional comment for the user itself', null=True)), + ('created', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='user.useractionlogentry')), + ('modified', models.ForeignKey(blank=True, help_text='Last modified', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='user.useractionlogentry')), + ('user', models.ForeignKey(help_text='The user who wants to be notifed', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/konova/models/object.py b/konova/models/object.py index 0fbd6e8..8af95e1 100644 --- a/konova/models/object.py +++ b/konova/models/object.py @@ -749,7 +749,6 @@ class GeoReferencedMixin(models.Model): class ResubmitableObjectMixin(models.Model): resubmissions = models.ManyToManyField( "konova.Resubmission", - null=True, blank=True, related_name="+", ) diff --git a/konova/utils/documents.py b/konova/utils/documents.py index f9b1516..3e8f6f1 100644 --- a/konova/utils/documents.py +++ b/konova/utils/documents.py @@ -5,10 +5,9 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 01.09.21 """ -from django.http import FileResponse, HttpRequest, HttpResponse, Http404 -from django.utils.translation import gettext_lazy as _ +from django.http import FileResponse, HttpRequest, Http404 -from konova.forms import RemoveModalForm +from konova.forms.modals import RemoveModalForm from konova.models import AbstractDocument from konova.utils.message_templates import DOCUMENT_REMOVED_TEMPLATE diff --git a/user/forms.py b/user/forms.py index 12688b4..0649eaf 100644 --- a/user/forms.py +++ b/user/forms.py @@ -15,7 +15,8 @@ from api.models import APIUserToken from intervention.inputs import GenerateInput from user.models import User, UserNotification, Team -from konova.forms import BaseForm, BaseModalForm, RemoveModalForm +from konova.forms.modals import BaseModalForm, RemoveModalForm +from konova.forms import BaseForm class UserNotificationForm(BaseForm): diff --git a/user/migrations/0006_auto_20220815_0759.py b/user/migrations/0006_auto_20220815_0759.py new file mode 100644 index 0000000..5386108 --- /dev/null +++ b/user/migrations/0006_auto_20220815_0759.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2022-08-15 05:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('user', '0005_team_deleted'), + ] + + operations = [ + migrations.AlterField( + model_name='usernotification', + name='id', + field=models.CharField(choices=[('NOTIFY_ON_SHARED_ACCESS_REMOVED', 'NOTIFY_ON_SHARED_ACCESS_REMOVED'), ('NOTIFY_ON_SHARED_DATA_RECORDED', 'NOTIFY_ON_SHARED_DATA_RECORDED'), ('NOTIFY_ON_SHARED_DATA_DELETED', 'NOTIFY_ON_SHARED_DATA_DELETED'), ('NOTIFY_ON_SHARED_DATA_CHECKED', 'NOTIFY_ON_SHARED_DATA_CHECKED'), ('NOTIFY_ON_SHARED_ACCESS_GAINED', 'NOTIFY_ON_SHARED_ACCESS_GAINED'), ('NOTIFY_ON_DEDUCTION_CHANGES', 'NOTIFY_ON_DEDUCTION_CHANGES')], max_length=500, primary_key=True, serialize=False), + ), + ] -- 2.38.5