EcoAccount withdraws

* adds functionality for withdraws from eco accounts in detail view of interventions and eco account as well
* adds get_surface() method to AbstractCompensation class to provide a simple getter for a sql calculation
* adds get_surface_withdraws() method to EcoAccount class to provide a simple getter for a sql calculation
* renames some routes to match coherent rout naming
* adds logic check on NewWithdrawForm
* renames templates/table directory to templates/form, since there are form-table templates inside --> more clarity
* adds new autocomplete routes to konova/urls.py for Interventions and EcoAccounts
* adds/updates translations
* adds/updates template comments
* updates requirements.txt
pull/9/head
mipel 3 years ago
parent 58510eee50
commit f8b3e5c8fd

@ -7,9 +7,8 @@ Created on: 17.11.20
"""
from django.contrib.auth.models import User
from django.contrib.gis.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import transaction
from django.utils import timezone
from django.core.validators import MinValueValidator
from django.db.models import Sum
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
@ -121,6 +120,14 @@ class AbstractCompensation(BaseObject):
class Meta:
abstract = True
def get_surface(self) -> float:
""" Calculates the compensation's/account's surface
Returns:
sum_surface (float)
"""
return self.after_states.all().aggregate(Sum("surface"))["surface__sum"]
class Compensation(AbstractCompensation):
"""
@ -188,6 +195,14 @@ class EcoAccount(AbstractCompensation):
def __str__(self):
return "{}".format(self.identifier)
def get_surface_withdraws(self) -> float:
""" Calculates the compensation's/account's surface
Returns:
sum_surface (float)
"""
return self.withdraws.all().aggregate(Sum("surface"))["surface__sum"]
class EcoAccountWithdraw(BaseResource):
"""

@ -11,12 +11,10 @@
<div class="col-sm-6">
<div class="d-flex justify-content-end">
{% if is_default_member and has_access %}
<a href="{% url 'compensation:new' %}" title="{% trans 'Add new withdraw' %}">
<button class="btn btn-outline-default">
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-withdraw' obj.id %}" title="{% trans 'Add new withdraw' %}">
{% fa5_icon 'plus' %}
{% fa5_icon 'tree' %}
</button>
</a>
{% endif %}
</div>
</div>
@ -32,6 +30,9 @@
<th scope="col">
{% trans 'Amount' %}
</th>
<th scope="col">
{% trans 'Created' %}
</th>
<th scope="col">
{% trans 'Action' %}
</th>
@ -46,6 +47,7 @@
</a>
</td>
<td class="align-middle">{{ withdraw.surface|floatformat:2|intcomma }} m²</td>
<td class="align-middle">{{ withdraw.created.timestamp|default_if_none:""|naturalday}}</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'compensation:withdraw-remove' withdraw.account.id withdraw.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Withdraw' %}">

@ -36,6 +36,7 @@ urlaptterns_eco_acc = [
# Eco-account withdraws
path('acc/<id>/remove/<withdraw_id>', eco_account_views.withdraw_remove_view, name='withdraw-remove'),
path('acc/<id>/withdraw/new', eco_account_views.new_withdraw_view, name='acc-new-withdraw'),
]
urlpatterns_compensation = [

@ -16,6 +16,7 @@ from django.shortcuts import render, get_object_or_404
from compensation.forms import NewStateModalForm, NewActionModalForm, NewDeadlineModalForm
from compensation.models import EcoAccount
from compensation.tables import EcoAccountTable
from intervention.forms import NewWithdrawForm
from konova.contexts import BaseContext
from konova.decorators import any_group_check, default_group_required
from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm
@ -94,8 +95,7 @@ def open_view(request: HttpRequest, id: str):
diff_states = abs(sum_before_states - sum_after_states)
# Calculate rest of available surface for withdraws
withdraws = acc.withdraws.all()
withdraw_surfaces = withdraws.aggregate(Sum("surface"))["surface__sum"] or 0
withdraw_surfaces = acc.get_surface_withdraws() or 0
available = int(((sum_after_states - withdraw_surfaces) / sum_after_states) * 100)
context = {
@ -260,3 +260,23 @@ def new_document_view(request: HttpRequest, id: str):
request,
msg_success=_("Document added")
)
@login_required
@default_group_required
def new_withdraw_view(request: HttpRequest, id: str):
""" Renders a modal form view for creating withdraws
Args:
request ():
id ():
Returns:
"""
acc = get_object_or_404(EcoAccount, id=id)
form = NewWithdrawForm(request.POST or None, instance=acc, user=request.user)
return form.process_request(
request,
msg_success=_("Withdraw added")
)

@ -14,6 +14,7 @@ from django.db import transaction
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from compensation.models import EcoAccountWithdraw, EcoAccount
from intervention.models import Intervention, Revocation
from konova.forms import BaseForm, BaseModalForm
from konova.models import Document
@ -423,3 +424,126 @@ class RunCheckForm(BaseModalForm):
self.instance.checked = user_action
self.instance.log.add(user_action)
self.instance.save()
class NewWithdrawForm(BaseModalForm):
""" Form for creating new withdraws
Can be used for Intervention view as well as for EcoAccount views.
Parameter 'instance' can be an intervention, as well as an ecoAccount.
An instance check handles both workflows properly.
"""
account = forms.ModelChoiceField(
label=_("Eco-account"),
label_suffix="",
help_text=_("Only recorded accounts can be selected for withdraws"),
queryset=EcoAccount.objects.filter(deleted=None, recorded__isnull=False),
widget=autocomplete.ModelSelect2(
url="accounts-autocomplete",
attrs={
"data-placeholder": _("Eco-account"),
"data-minimum-input-length": 3,
"readonly": True,
}
),
)
surface = forms.DecimalField(
min_value=0.00,
decimal_places=2,
label=_("Surface"),
label_suffix="",
help_text=_("in m²"),
)
intervention = forms.ModelChoiceField(
label=_("Intervention"),
label_suffix="",
help_text=_("Only shared interventions can be selected"),
queryset=Intervention.objects.filter(deleted=None),
widget=autocomplete.ModelSelect2(
url="interventions-autocomplete",
attrs={
"data-placeholder": _("Intervention"),
"data-minimum-input-length": 3,
}
),
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.form_title = _("New Withdraw")
self.form_caption = _("Enter the information for a new withdraw from a chosen eco-account")
self.is_intervention_initially = False
# Add a placeholder for field 'surface' without having to define the whole widget above
self.fields["surface"].widget.attrs["placeholder"] = "0,00"
# Check for Intervention or EcoAccount
if isinstance(self.instance, Intervention):
# Form has been called with a given intervention
self.initialize_form_field("intervention", self.instance)
self.disable_form_field("intervention")
self.is_intervention_initially = True
elif isinstance(self.instance, EcoAccount):
# Form has been called with a given account --> make it initial in the form and read-only
self.initialize_form_field("account", self.instance)
self.disable_form_field("account")
else:
raise NotImplementedError
def is_valid(self):
""" Custom validity check
Makes sure the withdraw can not contain more surface than the account still provides
Returns:
is_valid (bool)
"""
super_result = super().is_valid()
if self.is_intervention_initially:
acc = self.cleaned_data["account"]
else:
acc = self.instance
sum_surface = acc.get_surface()
sum_surface_withdraws = acc.get_surface_withdraws()
rest_surface = sum_surface - sum_surface_withdraws
form_surface = float(self.cleaned_data["surface"])
is_valid_surface = form_surface < rest_surface
if not is_valid_surface:
self.add_error(
"surface",
_("The account {} has not enough surface for a withdraw of {} m². There are only {} m² left").format(acc.identifier, form_surface, rest_surface),
)
return is_valid_surface and super_result
def save(self):
with transaction.atomic():
# Create log entry
user_action_edit = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED
)
user_action_create = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.CREATED
)
self.instance.log.add(user_action_edit)
# Create withdraw depending on Intervention or EcoAccount as the initial instance
if self.is_intervention_initially:
withdraw = EcoAccountWithdraw.objects.create(
intervention=self.instance,
account=self.cleaned_data["account"],
surface=self.cleaned_data["surface"],
created=user_action_create,
)
else:
withdraw = EcoAccountWithdraw.objects.create(
intervention=self.cleaned_data["intervention"],
account=self.instance,
surface=self.cleaned_data["surface"],
created=user_action_create,
)
return withdraw

@ -14,7 +14,7 @@
Only show add-button if no revocation exists, yet.
{% endcomment %}
{% if is_default_member and has_access and not intervention.legal.revocation %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:revocation-new' intervention.id %}" title="{% trans 'Add revocation' %}">
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-revocation' intervention.id %}" title="{% trans 'Add revocation' %}">
{% fa5_icon 'plus' %}
{% fa5_icon 'ban' %}
</button>
@ -56,7 +56,7 @@
</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'intervention:revocation-remove' rev.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove revocation' %}">
<button data-form-url="{% url 'intervention:remove-revocation' rev.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove revocation' %}">
{% fa5_icon 'trash' %}
</button>
{% endif %}

@ -11,12 +11,10 @@
<div class="col-sm-6">
<div class="d-flex justify-content-end">
{% if is_default_member and has_access %}
<a href="{% url 'compensation:new' %}" title="{% trans 'Add new withdraw' %}">
<button class="btn btn-outline-default">
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:acc-new-withdraw' intervention.id %}" title="{% trans 'Add new withdraw' %}">
{% fa5_icon 'plus' %}
{% fa5_icon 'tree' %}
</button>
</a>
{% endif %}
</div>
</div>
@ -32,6 +30,9 @@
<th scope="col">
{% trans 'Amount' %}
</th>
<th scope="col">
{% trans 'Created' %}
</th>
<th scope="col">
{% trans 'Action' %}
</th>
@ -49,6 +50,7 @@
</a>
</td>
<td class="align-middle">{{ withdraw.surface|floatformat:2|intcomma }} m²</td>
<td class="align-middle">{{ withdraw.created.timestamp|default_if_none:""|naturalday}}</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'compensation:withdraw-remove' withdraw.account.id withdraw.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Withdraw' %}">

@ -8,7 +8,7 @@ Created on: 30.11.20
from django.urls import path
from intervention.views import index_view, new_view, open_view, edit_view, remove_view, new_document_view, share_view, \
create_share_view, remove_revocation_view, new_revocation_view, run_check_view, log_view
create_share_view, remove_revocation_view, new_revocation_view, run_check_view, log_view, new_withdraw_view
app_name = "intervention"
urlpatterns = [
@ -23,7 +23,10 @@ urlpatterns = [
path('<id>/share', create_share_view, name='share-create'),
path('<id>/check', run_check_view, name='run-check'),
# Withdraws
path('<id>/withdraw/new', new_withdraw_view, name='acc-new-withdraw'),
# Revocation routes
path('<id>/revocation/new', new_revocation_view, name='revocation-new'),
path('revocation/<id>/remove', remove_revocation_view, name='revocation-remove'),
path('<id>/revocation/new', new_revocation_view, name='new-revocation'),
path('revocation/<id>/remove', remove_revocation_view, name='remove-revocation'),
]

@ -5,7 +5,7 @@ from django.http import HttpRequest
from django.shortcuts import render, get_object_or_404
from intervention.forms import NewInterventionForm, EditInterventionForm, ShareInterventionForm, NewRevocationForm, \
RunCheckForm
RunCheckForm, NewWithdrawForm
from intervention.models import Intervention, Revocation
from intervention.tables import InterventionTable
from konova.contexts import BaseContext
@ -392,3 +392,23 @@ def log_view(request: HttpRequest, id: str):
}
context = BaseContext(request, context).context
return render(request, template, context)
@login_required
@default_group_required
def new_withdraw_view(request: HttpRequest, id: str):
""" Renders a modal form view for creating withdraws
Args:
request (HttpRequest): The incoming request
id (str): The intervention's id which shall get a new withdraw
Returns:
"""
intervention = get_object_or_404(Intervention, id=id)
form = NewWithdrawForm(request.POST or None, instance=intervention, user=request.user)
return form.process_request(
request,
msg_success=_("Withdraw added")
)

@ -7,6 +7,8 @@ Created on: 07.12.20
"""
from dal_select2.views import Select2QuerySetView
from compensation.models import EcoAccount
from intervention.models import Intervention
from organisation.models import Organisation
@ -36,3 +38,39 @@ class NonOfficialOrganisationAutocomplete(Select2QuerySetView):
"name"
)
return qs
class EcoAccountAutocomplete(Select2QuerySetView):
def get_queryset(self):
if self.request.user.is_anonymous:
return EcoAccount.objects.none()
qs = EcoAccount.objects.filter(
deleted=None,
recorded__isnull=False,
)
if self.q:
qs = qs.filter(
identifier__icontains=self.q
)
qs = qs.order_by(
"identifier"
)
return qs
class InterventionAutocomplete(Select2QuerySetView):
def get_queryset(self):
if self.request.user.is_anonymous:
return Intervention.objects.none()
qs = Intervention.objects.filter(
deleted=None,
users__in=[self.request.user],
)
if self.q:
qs = qs.filter(
identifier__icontains=self.q
)
qs = qs.order_by(
"identifier"
)
return qs

@ -3,6 +3,6 @@
{% block body %}
<div class="column">
{% include 'table/generic_table_form.html' %}
{% include 'form/generic_table_form.html' %}
</div>
{% endblock %}

@ -18,7 +18,8 @@ from django.contrib import admin
from django.urls import path, include
from simple_sso.sso_client.client import Client
from konova.autocompletes import OrganisationAutocomplete, NonOfficialOrganisationAutocomplete
from konova.autocompletes import OrganisationAutocomplete, NonOfficialOrganisationAutocomplete, EcoAccountAutocomplete, \
InterventionAutocomplete
from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG
from konova.views import logout_view, home_view, get_document_view, remove_document_view, remove_deadline_view
@ -45,6 +46,8 @@ urlpatterns = [
# Autocomplete paths
path("atcmplt/orgs", OrganisationAutocomplete.as_view(), name="orgs-autocomplete"),
path("atcmplt/orgs/other", NonOfficialOrganisationAutocomplete.as_view(), name="other-orgs-autocomplete"),
path("atcmplt/eco-accounts", EcoAccountAutocomplete.as_view(), name="accounts-autocomplete"),
path("atcmplt/interventions", InterventionAutocomplete.as_view(), name="interventions-autocomplete"),
]
if DEBUG:

Binary file not shown.

@ -7,8 +7,8 @@
#: compensation/forms.py:203 compensation/forms.py:271
#: intervention/filters.py:26 intervention/filters.py:40
#: intervention/filters.py:47 intervention/filters.py:48
#: intervention/forms.py:318 intervention/forms.py:330
#: intervention/forms.py:342 konova/forms.py:91 konova/forms.py:227
#: intervention/forms.py:321 intervention/forms.py:333
#: intervention/forms.py:345 konova/forms.py:91 konova/forms.py:227
#: konova/forms.py:260 konova/forms.py:265 konova/forms.py:277
#: konova/forms.py:289 konova/forms.py:302 user/forms.py:38
#, fuzzy
@ -16,7 +16,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-09 15:06+0200\n"
"POT-Creation-Date: 2021-08-10 10:30+0200\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"
@ -27,8 +27,8 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: compensation/forms.py:41 compensation/forms.py:260
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:33
#: intervention/templates/intervention/detail/includes/withdraws.html:33
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:31
#: intervention/templates/intervention/detail/includes/withdraws.html:31
msgid "Amount"
msgstr "Menge"
@ -78,10 +78,11 @@ msgstr "Biotoptyp wählen"
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:36
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:36
#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36
#: intervention/forms.py:449
msgid "Surface"
msgstr "Fläche"
#: compensation/forms.py:106
#: compensation/forms.py:106 intervention/forms.py:451
msgid "in m²"
msgstr ""
@ -112,7 +113,7 @@ msgstr "Fristart wählen"
#: compensation/forms.py:187
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:31
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:31
#: intervention/forms.py:317
#: intervention/forms.py:320
msgid "Date"
msgstr "Datum"
@ -127,7 +128,7 @@ msgstr "Datum wählen"
#: 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/documents.html:31
#: intervention/forms.py:341
#: intervention/forms.py:344
#: intervention/templates/intervention/detail/includes/documents.html:31
#: intervention/templates/intervention/detail/includes/revocation.html:35
#: konova/forms.py:288
@ -135,7 +136,7 @@ msgid "Comment"
msgstr "Kommentar"
#: compensation/forms.py:204 compensation/forms.py:272
#: intervention/forms.py:343 konova/forms.py:290
#: intervention/forms.py:346 konova/forms.py:290
msgid "Additional comment, maximum {} letters"
msgstr "Zusätzlicher Kommentar, maximal {} Zeichen"
@ -183,32 +184,32 @@ msgstr "Geben Sie die Daten der neuen Maßnahme ein"
msgid "Added action"
msgstr "Maßnahme hinzugefügt"
#: compensation/models.py:59
#: compensation/models.py:60
msgid "cm"
msgstr ""
#: compensation/models.py:60
#: compensation/models.py:61
msgid "m"
msgstr ""
#: compensation/models.py:61
#: compensation/models.py:62
msgid "km"
msgstr ""
#: compensation/models.py:62
#: compensation/models.py:63
msgid "m²"
msgstr ""
#: compensation/models.py:63
#: compensation/models.py:64
msgid "ha"
msgstr ""
#: compensation/models.py:64
#: compensation/models.py:65
msgid "Pieces"
msgstr "Stück"
#: compensation/tables.py:26 compensation/tables.py:166
#: intervention/forms.py:28 intervention/tables.py:23
#: intervention/forms.py:31 intervention/tables.py:23
#: intervention/templates/intervention/detail/includes/compensations.html:30
msgid "Identifier"
msgstr "Kennung"
@ -218,7 +219,7 @@ msgstr "Kennung"
#: compensation/templates/compensation/detail/compensation/view.html:24
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:28
#: compensation/templates/compensation/detail/eco_account/view.html:24
#: intervention/forms.py:35 intervention/tables.py:28
#: intervention/forms.py:38 intervention/tables.py:28
#: intervention/templates/intervention/detail/includes/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28
#: intervention/templates/intervention/detail/view.html:24 konova/forms.py:259
@ -309,6 +310,7 @@ msgstr "Ökokonten"
#: compensation/tables.py:224
#: compensation/templates/compensation/detail/eco_account/view.html:12
#: intervention/forms.py:433 intervention/forms.py:440
#: konova/templates/konova/home.html:88 templates/navbar.html:34
msgid "Eco-account"
msgstr "Ökokonto"
@ -350,12 +352,12 @@ msgstr "Menge"
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:34
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:39
#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:39
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:36
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:37
#: intervention/templates/intervention/detail/includes/compensations.html:36
#: intervention/templates/intervention/detail/includes/documents.html:34
#: intervention/templates/intervention/detail/includes/payments.html:37
#: intervention/templates/intervention/detail/includes/revocation.html:41
#: intervention/templates/intervention/detail/includes/withdraws.html:36
#: intervention/templates/intervention/detail/includes/withdraws.html:37
#: templates/log.html:10
msgid "Action"
msgstr "Aktionen"
@ -408,7 +410,7 @@ msgstr "Neue Frist hinzufügen"
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:28
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:28
#: intervention/forms.py:40
#: intervention/forms.py:43
msgid "Type"
msgstr "Typ"
@ -511,7 +513,7 @@ msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/compensation/view.html:72
#: compensation/templates/compensation/detail/eco_account/view.html:58
#: intervention/forms.py:251
#: intervention/forms.py:254
#: intervention/templates/intervention/detail/view.html:104
msgid "Shared with"
msgstr "Freigegeben für"
@ -532,17 +534,23 @@ msgstr "Ökokonto Abbuchungen"
msgid "Add new withdraw"
msgstr "Neue Abbuchung hinzufügen"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:30
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:28
msgid "Intervention Identifier"
msgstr "Eingriffskennung"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:51
#: intervention/templates/intervention/detail/includes/withdraws.html:54
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:34
#: intervention/templates/intervention/detail/includes/withdraws.html:34
#: user/models.py:50
msgid "Created"
msgstr "Erstellt"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:53
#: intervention/templates/intervention/detail/includes/withdraws.html:56
msgid "Remove Withdraw"
msgstr "Abbuchung entfernen"
#: compensation/views/compensation_views.py:121
#: compensation/views/eco_account_views.py:184 intervention/views.py:391
#: compensation/views/eco_account_views.py:185 intervention/views.py:391
msgid "Log"
msgstr "Log"
@ -551,22 +559,22 @@ msgid "Compensation removed"
msgstr "Kompensation entfernt"
#: compensation/views/compensation_views.py:161
#: compensation/views/eco_account_views.py:261 intervention/views.py:96
#: compensation/views/eco_account_views.py:262 intervention/views.py:96
msgid "Document added"
msgstr "Dokument hinzugefügt"
#: compensation/views/compensation_views.py:180
#: compensation/views/eco_account_views.py:205
#: compensation/views/eco_account_views.py:206
msgid "State added"
msgstr "Zustand hinzugefügt"
#: compensation/views/compensation_views.py:199
#: compensation/views/eco_account_views.py:224
#: compensation/views/eco_account_views.py:225
msgid "Action added"
msgstr "Maßnahme hinzugefügt"
#: compensation/views/compensation_views.py:218
#: compensation/views/eco_account_views.py:243
#: compensation/views/eco_account_views.py:244
msgid "Deadline added"
msgstr "Frist hinzugefügt"
@ -578,14 +586,18 @@ msgstr "Zustand gelöscht"
msgid "Action removed"
msgstr "Maßnahme entfernt"
#: compensation/views/eco_account_views.py:134
#: compensation/views/eco_account_views.py:135
msgid "Eco-account removed"
msgstr "Ökokonto entfernt"
#: compensation/views/eco_account_views.py:161
#: compensation/views/eco_account_views.py:162
msgid "Withdraw removed"
msgstr "Abbuchung entfernt"
#: compensation/views/eco_account_views.py:282 intervention/views.py:413
msgid "Withdraw added"
msgstr "Abbuchung hinzugefügt"
#: compensation/views/payment_views.py:43
msgid "Payment added"
msgstr "Zahlung hinzugefügt"
@ -610,125 +622,125 @@ msgstr "Gemarkung"
msgid "Search for district"
msgstr "Nach Gemarkung suchen"
#: intervention/forms.py:31
#: intervention/forms.py:34
msgid "Generated automatically if none was given"
msgstr "Wird automatisch erzeugt, falls nicht angegeben"
#: intervention/forms.py:43
#: intervention/forms.py:46
msgid "Which intervention type is this"
msgstr "Welcher Eingriffstyp"
#: intervention/forms.py:46
#: intervention/forms.py:49
#: intervention/templates/intervention/detail/view.html:32
msgid "Law"
msgstr "Gesetz"
#: intervention/forms.py:49
#: intervention/forms.py:52
msgid "Based on which law"
msgstr "Basiert auf welchem Recht"
#: intervention/forms.py:52
#: intervention/forms.py:55
#: intervention/templates/intervention/detail/view.html:52
msgid "Intervention handler"
msgstr "Eingriffsverursacher"
#: intervention/forms.py:55
#: intervention/forms.py:58
msgid "Who performs the intervention"
msgstr "Wer führt den Eingriff durch"
#: intervention/forms.py:58
#: intervention/forms.py:61
msgid "Data provider"
msgstr "Datenbereitsteller"
#: intervention/forms.py:60
#: intervention/forms.py:63
msgid "Who provides the data for the intervention"
msgstr "Wer stellt die Daten für den Eingriff zur Verfügung"
#: intervention/forms.py:65
#: intervention/forms.py:68
msgid "Organization"
msgstr "Organisation"
#: intervention/forms.py:71
#: intervention/forms.py:74
msgid "Data provider details"
msgstr "Datenbereitsteller Details"
#: intervention/forms.py:74
#: intervention/forms.py:77
msgid "Further details"
msgstr "Weitere Details"
#: intervention/forms.py:87
#: intervention/forms.py:90
msgid "Map"
msgstr "Karte"
#: intervention/forms.py:89
#: intervention/forms.py:92
msgid "Where does the intervention take place"
msgstr "Wo findet der Eingriff statt"
#: intervention/forms.py:97
#: intervention/forms.py:100
msgid "Files"
msgstr "Dateien"
#: intervention/forms.py:104
#: intervention/forms.py:107
msgid "New intervention"
msgstr "Neuer Eingriff"
#: intervention/forms.py:146
#: intervention/forms.py:149
msgid "Edit intervention"
msgstr "Eingriff bearbeiten"
#: intervention/forms.py:240
#: intervention/forms.py:243
msgid "Share link"
msgstr "Freigabelink"
#: intervention/forms.py:242
#: intervention/forms.py:245
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.py:254
#: intervention/forms.py:257
msgid "Remove check to remove access for this user"
msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen"
#: intervention/forms.py:265
#: intervention/forms.py:268
#: intervention/templates/intervention/detail/includes/controls.html:15
msgid "Share"
msgstr "Freigabe"
#: intervention/forms.py:266
#: intervention/forms.py:269
msgid "Share settings for {}"
msgstr "Freigabe Einstellungen für {}"
#: intervention/forms.py:319
#: intervention/forms.py:322
msgid "Date of revocation"
msgstr "Datum des Widerspruchs"
#: intervention/forms.py:329
#: intervention/forms.py:332
#: intervention/templates/intervention/detail/includes/revocation.html:38
msgid "Document"
msgstr "Dokument"
#: intervention/forms.py:331 konova/forms.py:278
#: intervention/forms.py:334 konova/forms.py:278
msgid "Must be smaller than 15 Mb"
msgstr "Muss kleiner als 15 Mb sein"
#: intervention/forms.py:354
#: intervention/forms.py:357
#: intervention/templates/intervention/detail/includes/revocation.html:18
msgid "Add revocation"
msgstr "Widerspruch hinzufügen"
#: intervention/forms.py:390
#: intervention/forms.py:393
msgid "Checked intervention data"
msgstr "Eingriffsdaten geprüft"
#: intervention/forms.py:396
#: intervention/forms.py:399
msgid "Checked compensations data and payments"
msgstr "Kompensationen und Zahlungen geprüft"
#: intervention/forms.py:404
#: intervention/forms.py:407
#: intervention/templates/intervention/detail/includes/controls.html:19
msgid "Run check"
msgstr "Prüfung vornehmen"
#: intervention/forms.py:405
#: intervention/forms.py:408
msgid ""
"I, {} {}, confirm that all necessary control steps have been performed by "
"myself."
@ -736,6 +748,37 @@ msgstr ""
"Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt "
"wurden:"
#: intervention/forms.py:435
msgid "Only recorded accounts can be selected for withdraws"
msgstr ""
"Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden."
#: intervention/forms.py:454 intervention/forms.py:461
#: intervention/tables.py:92 intervention/tables.py:172
#: intervention/templates/intervention/detail/view.html:12
#: konova/templates/konova/home.html:11 templates/navbar.html:22
msgid "Intervention"
msgstr "Eingriff"
#: intervention/forms.py:456
msgid "Only shared interventions can be selected"
msgstr "Nur freigegebene Eingriffe können gewählt werden"
#: intervention/forms.py:469
msgid "New Withdraw"
msgstr "Neue Abbuchung"
#: intervention/forms.py:470
msgid "Enter the information for a new withdraw from a chosen eco-account"
msgstr "Geben Sie die Informationen für eine neue Abbuchung ein."
#: intervention/forms.py:511
msgid ""
"The account {} has not enough surface for a withdraw of {} m². There are "
"only {} m² left"
msgstr ""
"Das Ökokonto {} hat für eine Abbuchung von {} m² nicht ausreichend Restfläche. Es stehen noch {} m² zur Verfügung."
#: intervention/models.py:203
#: intervention/templates/intervention/detail/view.html:23
#: intervention/templates/intervention/detail/view.html:27
@ -756,12 +799,6 @@ msgstr "Existiert"
msgid "Interventions"
msgstr "Eingriffe"
#: intervention/tables.py:92 intervention/tables.py:172
#: intervention/templates/intervention/detail/view.html:12
#: konova/templates/konova/home.html:11 templates/navbar.html:22
msgid "Intervention"
msgstr "Eingriff"
#: intervention/tables.py:179
msgid "Edit {}"
msgstr "Bearbeite {}"
@ -817,11 +854,11 @@ msgstr "Vom"
msgid "Remove revocation"
msgstr "Widerspruch entfernen"
#: intervention/templates/intervention/detail/includes/withdraws.html:30
#: intervention/templates/intervention/detail/includes/withdraws.html:28
msgid "Account Identifier"
msgstr "Ökokonto Kennung"
#: intervention/templates/intervention/detail/includes/withdraws.html:42
#: intervention/templates/intervention/detail/includes/withdraws.html:43
msgid "Eco-account deleted! Withdraw invalid!"
msgstr "Ökokonto gelöscht! Abbuchung ungültig!"
@ -1101,6 +1138,18 @@ msgstr ""
msgid "Contact"
msgstr "Kontakt"
#: templates/form/generic_table_form.html:23
msgid "Cancel"
msgstr "Abbrechen"
#: templates/form/generic_table_form.html:27
msgid "Save"
msgstr "Speichern"
#: templates/form/generic_table_form_body.html:21
msgid "Fields with * are required."
msgstr "* sind Pflichtfelder."
#: templates/generic_index.html:19
msgid "New entry"
msgstr "Neuer Eintrag"
@ -1185,18 +1234,6 @@ msgstr "Einstellungen"
msgid "Logout"
msgstr "Abmelden"
#: templates/table/generic_table_form.html:23
msgid "Cancel"
msgstr "Abbrechen"
#: templates/table/generic_table_form.html:27
msgid "Save"
msgstr "Speichern"
#: templates/table/generic_table_form_body.html:21
msgid "Fields with * are required."
msgstr "* sind Pflichtfelder."
#: user/forms.py:23
msgid "Notifications"
msgstr "Benachrichtigungen"
@ -1225,10 +1262,6 @@ msgstr ""
msgid "User contact data"
msgstr "Kontaktdaten"
#: user/models.py:50
msgid "Created"
msgstr "Erstellt"
#: user/models.py:51
msgid "Edited"
msgstr "Bearbeitet"
@ -2599,10 +2632,6 @@ msgstr ""
#~ msgid "Registration document identifier"
#~ msgstr "Aktenzeichen Eintragungsstelle"
#~ msgid "Enter these basic information for the new process."
#~ msgstr ""
#~ "Geben Sie die grundlegenden Informationen für einen neuen Vorgang ein."
#~ msgid "Edit process"
#~ msgstr "Vorgang bearbeiten"

@ -3,7 +3,7 @@ beautifulsoup4==4.9.3
certifi==2020.11.8
chardet==3.0.4
Django==3.1.3
django-autocomplete-light==3.8.1
django-autocomplete-light==3.8.2
django-bootstrap-modal-forms==2.2.0
django-bootstrap4==3.0.1
django-debug-toolbar==3.1.1

@ -9,11 +9,10 @@
{% fontawesome_5_static %}
<link rel="stylesheet" href="{% static 'css/konova.css' %}">
{% comment %}
Adds script for modal rendering
Adds script for modal rendering. Script depends on Jquery, therefore it needs to be loaded afterwards.
{% endcomment %}
<script src="{% static 'js/jquery.bootstrap.modal.forms.min.js' %}"></script>
{% block head %}
{% endblock %}
</head>
<body>

@ -14,4 +14,15 @@
</div>
</div>
{% comment %}
"Why is there a form.media call???"
We use modal forms, right?
And we use dal (django-autocomplete-light), right?
In order to get these nice autocomplete (js triggered) form fields to work, we need to load form.media
somewhere. BUT when these fields are called inside a modal form (which we use quiet often), the form.media
can not be called properly due to some deprecated functions of jquery regarding synchronous calling.
So, we simply call the form.media in here, in case there is any form.media to be loaded.
{% endcomment %}
{{ form.media }}
</footer>

@ -16,7 +16,7 @@
{% endif %}
<form method="post" action="{{ form.action_url }}" {% for attr_key, attr_val in form.form_attrs.items %} {{attr_key}}="{{attr_val}}"{% endfor %}>
{% csrf_token %}
{% include 'table/generic_table_form_body.html' %}
{% include 'form/generic_table_form_body.html' %}
<div class="row">
<div class="col-md">
<a href="{{ form.cancel_redirect }}">

@ -1,4 +1,4 @@
{% load i18n l10n %}
{% load i18n l10n bootstrap4 %}
{% comment %}
A generic modal form template which is based on django-bootstrap-modal-forms package
https://pypi.org/project/django-bootstrap-modal-forms/
@ -18,7 +18,7 @@
<article>
{{ form.form_caption }}
</article>
{% include 'table/generic_table_form_body.html' %}
{% include 'form/generic_table_form_body.html' %}
</div>
{% if form.render_submit %}
<div class="modal-footer">

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% block body %}
{% include 'table/generic_table_form.html' %}
{% include 'form/generic_table_form.html' %}
{% endblock %}
Loading…
Cancel
Save