#38 User requests

* implements 5) "Add 'Maßnahmentyp' for KOMs "
    * prepares model and form fields as mixins for easy extension to eco accounts and emas (possibly in the future?)
This commit is contained in:
mpeltriaux 2021-11-15 15:55:09 +01:00
parent e4a40cdff5
commit 9211068dc7
7 changed files with 188 additions and 68 deletions

View File

@ -115,7 +115,33 @@ class CompensationResponsibleFormMixin(forms.Form):
)
class NewCompensationForm(AbstractCompensationForm):
class CEFCompensationFormMixin(forms.Form):
""" A form mixin, providing CEF compensation field
"""
is_cef = forms.BooleanField(
label_suffix="",
label=_("Is CEF"),
help_text=_("Optionally: Whether this compensation is a CEF compensation?"),
required=False,
widget=forms.CheckboxInput()
)
class CoherenceCompensationFormMixin(forms.Form):
""" A form mixin, providing coherence compensation field
"""
is_coherence_keeping = forms.BooleanField(
label_suffix="",
label=_("Is coherence keeping"),
help_text=_("Optionally: Whether this compensation is a coherence keeping compensation?"),
required=False,
widget=forms.CheckboxInput()
)
class NewCompensationForm(AbstractCompensationForm, CEFCompensationFormMixin, CoherenceCompensationFormMixin):
""" Form for creating new compensations.
Can be initialized with an intervention id for preselecting the related intervention.
@ -146,6 +172,8 @@ class NewCompensationForm(AbstractCompensationForm):
"identifier",
"title",
"intervention",
"is_cef",
"is_coherence_keeping",
"comment",
]
@ -177,6 +205,8 @@ class NewCompensationForm(AbstractCompensationForm):
identifier = self.cleaned_data.get("identifier", None)
title = self.cleaned_data.get("title", None)
intervention = self.cleaned_data.get("intervention", None)
is_cef = self.cleaned_data.get("is_cef", None)
is_coherence_keeping = self.cleaned_data.get("is_coherence_keeping", None)
comment = self.cleaned_data.get("comment", None)
# Create log entry
@ -193,6 +223,8 @@ class NewCompensationForm(AbstractCompensationForm):
title=title,
intervention=intervention,
created=action,
is_cef=is_cef,
is_coherence_keeping=is_coherence_keeping,
geometry=geometry,
comment=comment,
)
@ -217,6 +249,8 @@ class EditCompensationForm(NewCompensationForm):
"identifier": self.instance.identifier,
"title": self.instance.title,
"intervention": self.instance.intervention,
"is_cef": self.instance.is_cef,
"is_coherence_keeping": self.instance.is_coherence_keeping,
"comment": self.instance.comment,
}
disabled_fields = []
@ -231,6 +265,8 @@ class EditCompensationForm(NewCompensationForm):
identifier = self.cleaned_data.get("identifier", None)
title = self.cleaned_data.get("title", None)
intervention = self.cleaned_data.get("intervention", None)
is_cef = self.cleaned_data.get("is_cef", None)
is_coherence_keeping = self.cleaned_data.get("is_coherence_keeping", None)
comment = self.cleaned_data.get("comment", None)
# Create log entry
@ -247,6 +283,8 @@ class EditCompensationForm(NewCompensationForm):
self.instance.title = title
self.instance.intervention = intervention
self.instance.geometry = geometry
self.instance.is_cef = is_cef
self.instance.is_coherence_keeping = is_coherence_keeping
self.instance.comment = comment
self.instance.modified = action
self.instance.save()

View File

@ -189,7 +189,37 @@ class AbstractCompensation(BaseObject):
return checker
class Compensation(AbstractCompensation):
class CEFMixin(models.Model):
""" Provides CEF flag as Mixin
"""
is_cef = models.BooleanField(
blank=True,
null=True,
default=False,
help_text="Flag if compensation is a 'CEF-Maßnahme'"
)
class Meta:
abstract = True
class CoherenceMixin(models.Model):
""" Provides coherence keeping flag as Mixin
"""
is_coherence_keeping = models.BooleanField(
blank=True,
null=True,
default=False,
help_text="Flag if compensation is a 'Kohärenzsicherung'"
)
class Meta:
abstract = True
class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin):
"""
Regular compensation, linked to an intervention
"""

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load i18n l10n static fontawesome_5 humanize %}
{% load i18n l10n static fontawesome_5 humanize ksp_filters %}
{% block head %}
{% comment %}
@ -38,6 +38,26 @@
</a>
</td>
</tr>
<tr>
<th scope="row">{% trans 'Is CEF compensation' %}</th>
<td class="align-middle">
{% if obj.is_cef %}
{% trans 'Yes' %}
{% else %}
{% trans 'No' %}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Is Coherence keeping compensation' %}</th>
<td class="align-middle">
{% if obj.is_coherence_keeping %}
{% trans 'Yes' %}
{% else %}
{% trans 'No' %}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Checked' %}</th>
<td class="align-middle">

View File

@ -186,12 +186,15 @@ Overwrites bootstrap .btn:focus box shadow color
background-color: var(--rlp-gray-light);
}
.check-star{
.check-star, .c-goldenrod{
color: goldenrod;
}
.registered-bookmark{
.registered-bookmark, .c-green{
color: green;
}
.c-red{
color: red;
}
/* PAGINATION */
.page-item > .page-link{

View File

@ -8,6 +8,8 @@ Created on: 05.07.21
from django import template
# Create custom library
from django.utils.html import format_html
from news.models import ServerMessageImportance
register = template.Library()

Binary file not shown.

View File

@ -9,8 +9,8 @@
#: intervention/filters.py:26 intervention/filters.py:40
#: intervention/filters.py:47 intervention/filters.py:48
#: intervention/forms/forms.py:53 intervention/forms/forms.py:155
#: intervention/forms/forms.py:167 intervention/forms/modalForms.py:123
#: intervention/forms/modalForms.py:136 intervention/forms/modalForms.py:149
#: intervention/forms/forms.py:167 intervention/forms/modalForms.py:133
#: intervention/forms/modalForms.py:146 intervention/forms/modalForms.py:159
#: konova/forms.py:142 konova/forms.py:247 konova/forms.py:313
#: konova/forms.py:340 konova/forms.py:350 konova/forms.py:363
#: konova/forms.py:375 konova/forms.py:396 user/forms.py:38
@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-15 13:40+0100\n"
"POT-Creation-Date: 2021-11-15 15:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -54,9 +54,9 @@ msgid "Select the responsible office"
msgstr "Verantwortliche Stelle"
#: analysis/forms.py:58 compensation/forms/forms.py:87
#: compensation/forms/forms.py:138 intervention/forms/forms.py:63
#: compensation/forms/forms.py:164 intervention/forms/forms.py:63
#: intervention/forms/forms.py:80 intervention/forms/forms.py:96
#: intervention/forms/forms.py:112 intervention/forms/modalForms.py:48
#: intervention/forms/forms.py:112 intervention/forms/modalForms.py:47
msgid "Click for selection"
msgstr "Auswählen..."
@ -130,7 +130,7 @@ msgstr "Zuständigkeitsbereich"
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8
#: analysis/templates/analysis/reports/includes/intervention/laws.html:17
#: compensation/tables.py:35
#: compensation/templates/compensation/detail/compensation/view.html:43
#: compensation/templates/compensation/detail/compensation/view.html:63
#: intervention/tables.py:33
#: intervention/templates/intervention/detail/view.html:68 user/models.py:48
msgid "Checked"
@ -145,7 +145,7 @@ msgstr "Geprüft"
#: analysis/templates/analysis/reports/includes/intervention/laws.html:20
#: analysis/templates/analysis/reports/includes/old_data/amount.html:18
#: compensation/tables.py:41 compensation/tables.py:181
#: compensation/templates/compensation/detail/compensation/view.html:57
#: compensation/templates/compensation/detail/compensation/view.html:77
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31
#: compensation/templates/compensation/detail/eco_account/view.html:44
#: ema/tables.py:38 ema/templates/ema/detail/view.html:28
@ -210,7 +210,7 @@ msgstr "Abbuchungen"
#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36
#: ema/templates/ema/detail/includes/states-after.html:36
#: ema/templates/ema/detail/includes/states-before.html:36
#: intervention/forms/modalForms.py:291
#: intervention/forms/modalForms.py:301
msgid "Surface"
msgstr "Fläche"
@ -273,7 +273,7 @@ msgid "Type"
msgstr "Typ"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:24
#: intervention/forms/modalForms.py:302 intervention/forms/modalForms.py:309
#: intervention/forms/modalForms.py:312 intervention/forms/modalForms.py:319
#: intervention/tables.py:88
#: intervention/templates/intervention/detail/view.html:19
#: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22
@ -283,7 +283,7 @@ msgstr "Eingriff"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:34
#: compensation/tables.py:224
#: compensation/templates/compensation/detail/eco_account/view.html:19
#: intervention/forms/modalForms.py:275 intervention/forms/modalForms.py:282
#: intervention/forms/modalForms.py:285 intervention/forms/modalForms.py:292
#: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34
msgid "Eco-account"
msgstr "Ökokonto"
@ -350,7 +350,7 @@ msgstr "Kompensation XY; Flur ABC"
#: ema/templates/ema/detail/includes/actions.html:34
#: ema/templates/ema/detail/includes/deadlines.html:34
#: ema/templates/ema/detail/includes/documents.html:31
#: intervention/forms/forms.py:179 intervention/forms/modalForms.py:148
#: intervention/forms/forms.py:179 intervention/forms/modalForms.py:158
#: intervention/templates/intervention/detail/includes/documents.html:31
#: intervention/templates/intervention/detail/includes/payments.html:34
#: intervention/templates/intervention/detail/includes/revocation.html:38
@ -390,51 +390,69 @@ msgstr "Wer für die Herrichtung des Ökokontos verantwortlich ist"
msgid "Company Mustermann"
msgstr "Firma Mustermann"
#: compensation/forms/forms.py:129
#: compensation/forms/forms.py:124
msgid "Is CEF"
msgstr "Ist CEF-Maßnahme"
#: compensation/forms/forms.py:125
msgid "Optionally: Whether this compensation is a CEF compensation?"
msgstr "Optional: Handelt es sich um eine CEF-Maßnahme?"
#: compensation/forms/forms.py:137
msgid "Is coherence keeping"
msgstr "Ist Kohärenzsicherungsmaßnahme"
#: compensation/forms/forms.py:138
msgid ""
"Optionally: Whether this compensation is a coherence keeping compensation?"
msgstr ""
"Optional: Handelt es sich um eine Kohärenzsicherungsmaßnahme?"
#: compensation/forms/forms.py:155
#: compensation/templates/compensation/detail/compensation/view.html:35
#: compensation/templates/compensation/report/compensation/report.html:16
msgid "compensates intervention"
msgstr "kompensiert Eingriff"
#: compensation/forms/forms.py:131
#: compensation/forms/forms.py:157
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:155
#: compensation/forms/forms.py:183
msgid "New compensation"
msgstr "Neue Kompensation"
#: compensation/forms/forms.py:211
#: compensation/forms/forms.py:243
msgid "Edit compensation"
msgstr "Bearbeite Kompensation"
#: compensation/forms/forms.py:267 compensation/utils/quality.py:84
#: compensation/forms/forms.py:305 compensation/utils/quality.py:84
msgid "Available Surface"
msgstr "Verfügbare Fläche"
#: compensation/forms/forms.py:270
#: compensation/forms/forms.py:308
msgid "The amount that can be used for deductions"
msgstr "Die für Abbuchungen zur Verfügung stehende Menge"
#: compensation/forms/forms.py:279
#: compensation/forms/forms.py:317
#: compensation/templates/compensation/detail/eco_account/view.html:66
#: compensation/utils/quality.py:72
msgid "Agreement date"
msgstr "Vereinbarungsdatum"
#: compensation/forms/forms.py:281
#: compensation/forms/forms.py:319
msgid "When did the parties agree on this?"
msgstr "Wann wurde dieses Ökokonto offiziell vereinbart?"
#: compensation/forms/forms.py:305
#: compensation/forms/forms.py:343
msgid "New Eco-Account"
msgstr "Neues Ökokonto"
#: compensation/forms/forms.py:314
#: compensation/forms/forms.py:352
msgid "Eco-Account XY; Location ABC"
msgstr "Ökokonto XY; Flur ABC"
#: compensation/forms/forms.py:371
#: compensation/forms/forms.py:409
msgid "Edit Eco-Account"
msgstr "Ökokonto bearbeiten"
@ -452,7 +470,7 @@ msgid "Due on which date"
msgstr "Zahlung wird an diesem Datum erwartet"
#: compensation/forms/modalForms.py:63 compensation/forms/modalForms.py:274
#: compensation/forms/modalForms.py:369 intervention/forms/modalForms.py:150
#: compensation/forms/modalForms.py:369 intervention/forms/modalForms.py:160
#: konova/forms.py:376
msgid "Additional comment, maximum {} letters"
msgstr "Zusätzlicher Kommentar, maximal {} Zeichen"
@ -477,7 +495,7 @@ msgstr "Biotoptyp"
msgid "Select the biotope type"
msgstr "Biotoptyp wählen"
#: compensation/forms/modalForms.py:155 intervention/forms/modalForms.py:293
#: compensation/forms/modalForms.py:155 intervention/forms/modalForms.py:303
msgid "in m²"
msgstr ""
@ -509,7 +527,7 @@ msgstr "Fristart wählen"
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:31
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:31
#: ema/templates/ema/detail/includes/deadlines.html:31
#: intervention/forms/modalForms.py:122
#: intervention/forms/modalForms.py:132
msgid "Date"
msgstr "Datum"
@ -587,38 +605,38 @@ msgstr "Geben Sie die Daten der neuen Maßnahme ein"
msgid "Added action"
msgstr "Maßnahme hinzugefügt"
#: compensation/models.py:82
#: compensation/models.py:81
msgid "cm"
msgstr ""
#: compensation/models.py:83
#: compensation/models.py:82
msgid "m"
msgstr ""
#: compensation/models.py:84
#: compensation/models.py:83
msgid "km"
msgstr ""
#: compensation/models.py:85
#: compensation/models.py:84
msgid "m²"
msgstr ""
#: compensation/models.py:86
#: compensation/models.py:85
msgid "ha"
msgstr ""
#: compensation/models.py:87
#: compensation/models.py:86
msgid "Pieces"
msgstr "Stück"
#: compensation/models.py:345
#: compensation/models.py:374
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.py:352
#: compensation/models.py:381
msgid ""
"Deductable surface can not be smaller than the sum of already existing "
"deductions. Please contact the responsible users for the deductions!"
@ -650,7 +668,7 @@ msgid "Checked on {} by {}"
msgstr "Am {} von {} geprüft worden"
#: compensation/tables.py:129
#: compensation/templates/compensation/detail/compensation/view.html:60
#: compensation/templates/compensation/detail/compensation/view.html:80
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:56
#: compensation/templates/compensation/detail/eco_account/view.html:47
#: ema/tables.py:101 ema/templates/ema/detail/view.html:31
@ -853,13 +871,21 @@ msgstr "Neuen Ausgangszustand hinzufügen"
msgid "Missing surfaces according to states after: "
msgstr "Fehlende Flächenmengen laut Zielzustand: "
#: compensation/templates/compensation/detail/compensation/view.html:50
#: compensation/templates/compensation/detail/compensation/view.html:43
msgid "Is CEF compensation"
msgstr "Ist CEF Maßnahme"
#: compensation/templates/compensation/detail/compensation/view.html:53
msgid "Is Coherence keeping compensation"
msgstr "Ist Kohärenzsicherungsmaßnahme"
#: compensation/templates/compensation/detail/compensation/view.html:70
#: intervention/templates/intervention/detail/view.html:75
msgid "Checked on "
msgstr "Geprüft am "
#: compensation/templates/compensation/detail/compensation/view.html:50
#: compensation/templates/compensation/detail/compensation/view.html:64
#: compensation/templates/compensation/detail/compensation/view.html:70
#: compensation/templates/compensation/detail/compensation/view.html:84
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:54
#: compensation/templates/compensation/detail/eco_account/view.html:51
#: ema/templates/ema/detail/view.html:35
@ -868,14 +894,14 @@ msgstr "Geprüft am "
msgid "by"
msgstr "von"
#: compensation/templates/compensation/detail/compensation/view.html:64
#: compensation/templates/compensation/detail/compensation/view.html:84
#: compensation/templates/compensation/detail/eco_account/view.html:51
#: ema/templates/ema/detail/view.html:35
#: intervention/templates/intervention/detail/view.html:89
msgid "Recorded on "
msgstr "Verzeichnet am"
#: compensation/templates/compensation/detail/compensation/view.html:71
#: compensation/templates/compensation/detail/compensation/view.html:91
#: compensation/templates/compensation/detail/eco_account/view.html:74
#: compensation/templates/compensation/report/compensation/report.html:24
#: compensation/templates/compensation/report/eco_account/report.html:41
@ -886,16 +912,16 @@ msgstr "Verzeichnet am"
msgid "Last modified"
msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/compensation/view.html:79
#: compensation/templates/compensation/detail/compensation/view.html:99
#: compensation/templates/compensation/detail/eco_account/view.html:82
#: ema/templates/ema/detail/view.html:69 intervention/forms/modalForms.py:55
#: ema/templates/ema/detail/view.html:69 intervention/forms/modalForms.py:54
#: intervention/templates/intervention/detail/view.html:116
msgid "Shared with"
msgstr "Freigegeben für"
#: compensation/templates/compensation/detail/eco_account/includes/controls.html:15
#: ema/templates/ema/detail/includes/controls.html:15
#: intervention/forms/modalForms.py:69
#: intervention/forms/modalForms.py:68
#: intervention/templates/intervention/detail/includes/controls.html:15
msgid "Share"
msgstr "Freigabe"
@ -1249,65 +1275,66 @@ msgstr "Neuer Eingriff"
msgid "Edit intervention"
msgstr "Eingriff bearbeiten"
#: intervention/forms/modalForms.py:28
#: intervention/forms/modalForms.py:27
msgid "Share link"
msgstr "Freigabelink"
#: intervention/forms/modalForms.py:30
#: intervention/forms/modalForms.py:29
msgid "Send this link to users who you want to have writing access on the data"
msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten"
#: intervention/forms/modalForms.py:40
#: intervention/forms/modalForms.py:39
msgid "Add user to share with"
msgstr "Nutzer direkt hinzufügen"
#: intervention/forms/modalForms.py:42
#: intervention/forms/modalForms.py:41
msgid ""
"Multiple selection possible - You can only select users which do not already "
"have access"
msgstr ""
"Mehrfachauswahl möglich - Sie können nur Nutzer wählen, für die der Eintrag noch nicht freigegeben wurde"
"Mehrfachauswahl möglich - Sie können nur Nutzer wählen, für die der Eintrag "
"noch nicht freigegeben wurde"
#: intervention/forms/modalForms.py:58
#: intervention/forms/modalForms.py:57
msgid "Remove check to remove access for this user"
msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen"
#: intervention/forms/modalForms.py:70
#: intervention/forms/modalForms.py:69
msgid "Share settings for {}"
msgstr "Freigabe Einstellungen für {}"
#: intervention/forms/modalForms.py:124
#: intervention/forms/modalForms.py:134
msgid "Date of revocation"
msgstr "Datum des Widerspruchs"
#: intervention/forms/modalForms.py:135
#: intervention/forms/modalForms.py:145
#: intervention/templates/intervention/detail/includes/revocation.html:35
msgid "Document"
msgstr "Dokument"
#: intervention/forms/modalForms.py:138 konova/forms.py:364
#: intervention/forms/modalForms.py:148 konova/forms.py:364
msgid "Must be smaller than 15 Mb"
msgstr "Muss kleiner als 15 Mb sein"
#: intervention/forms/modalForms.py:162
#: intervention/forms/modalForms.py:172
#: intervention/templates/intervention/detail/includes/revocation.html:18
msgid "Add revocation"
msgstr "Widerspruch hinzufügen"
#: intervention/forms/modalForms.py:204
#: intervention/forms/modalForms.py:214
msgid "Checked intervention data"
msgstr "Eingriffsdaten geprüft"
#: intervention/forms/modalForms.py:210
#: intervention/forms/modalForms.py:220
msgid "Checked compensations data and payments"
msgstr "Kompensationen und Zahlungen geprüft"
#: intervention/forms/modalForms.py:218
#: intervention/forms/modalForms.py:228
#: intervention/templates/intervention/detail/includes/controls.html:19
msgid "Run check"
msgstr "Prüfung vornehmen"
#: intervention/forms/modalForms.py:219 konova/forms.py:449
#: intervention/forms/modalForms.py:229 konova/forms.py:449
msgid ""
"I, {} {}, confirm that all necessary control steps have been performed by "
"myself."
@ -1315,23 +1342,23 @@ msgstr ""
"Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt "
"wurden:"
#: intervention/forms/modalForms.py:277
#: intervention/forms/modalForms.py:287
msgid "Only recorded accounts can be selected for deductions"
msgstr "Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden."
#: intervention/forms/modalForms.py:304
#: intervention/forms/modalForms.py:314
msgid "Only shared interventions can be selected"
msgstr "Nur freigegebene Eingriffe können gewählt werden"
#: intervention/forms/modalForms.py:317
#: intervention/forms/modalForms.py:327
msgid "New Deduction"
msgstr "Neue Abbuchung"
#: intervention/forms/modalForms.py:318
#: intervention/forms/modalForms.py:328
msgid "Enter the information for a new deduction from a chosen eco-account"
msgstr "Geben Sie die Informationen für eine neue Abbuchung ein."
#: intervention/forms/modalForms.py:351
#: intervention/forms/modalForms.py:361
msgid ""
"Eco-account {} is not recorded yet. You can only deduct from recorded "
"accounts."
@ -1339,7 +1366,7 @@ msgstr ""
"Ökokonto {} ist noch nicht verzeichnet. Abbuchungen können nur von "
"verzeichneten Ökokonten erfolgen."
#: intervention/forms/modalForms.py:364
#: intervention/forms/modalForms.py:374
msgid ""
"The account {} has not enough surface for a deduction of {} m². There are "
"only {} m² left"