Konova code improvements
* improves rendering of codes as string (short names will be used if existing) * reduces selectable konova codes to leafs (as discussed with experts) * automatically resizes the width of modal form fields to w-100 * adds/updates translations
This commit is contained in:
@@ -13,8 +13,10 @@ 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 django.utils.translation import pgettext_lazy as _con
|
||||
|
||||
from codelist.models import KonovaCode
|
||||
from codelist.settings import CODELIST_BIOTOPES_ID
|
||||
from compensation.models import Payment, CompensationState, CompensationAction, UnitChoices
|
||||
from konova.contexts import BaseContext
|
||||
from konova.forms import BaseForm, BaseModalForm
|
||||
@@ -41,13 +43,14 @@ class NewPaymentForm(BaseModalForm):
|
||||
amount = forms.DecimalField(
|
||||
min_value=0.00,
|
||||
decimal_places=2,
|
||||
label=_("Amount"),
|
||||
label=_con("money", "Amount"), # contextual translation
|
||||
label_suffix=_(""),
|
||||
help_text=_("Amount in Euro"),
|
||||
help_text=_("in Euro"),
|
||||
)
|
||||
due = forms.DateField(
|
||||
label=_("Due on"),
|
||||
label_suffix=_(""),
|
||||
required=False,
|
||||
help_text=_("Due on which date"),
|
||||
widget=forms.DateInput(
|
||||
attrs={
|
||||
@@ -104,12 +107,13 @@ class NewStateModalForm(BaseModalForm):
|
||||
help_text=_("Select the biotope type"),
|
||||
queryset=KonovaCode.objects.filter(
|
||||
is_active=True,
|
||||
is_leaf=True,
|
||||
code_lists__in=[CODELIST_BIOTOPES_ID],
|
||||
),
|
||||
widget=autocomplete.ModelSelect2(
|
||||
url="codes-biotope-autocomplete",
|
||||
attrs={
|
||||
"data-placeholder": _("Biotope Type"),
|
||||
"data-minimum-input-length": 3,
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -280,7 +284,7 @@ class NewActionModalForm(BaseModalForm):
|
||||
url="codes-compensation-action-autocomplete",
|
||||
attrs={
|
||||
"data-placeholder": _("Action"),
|
||||
"data-minimum-input-length": 3,
|
||||
"data-class": "w-100",
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -312,8 +316,8 @@ class NewActionModalForm(BaseModalForm):
|
||||
help_text=_("Additional comment, maximum {} letters").format(200),
|
||||
widget=forms.Textarea(
|
||||
attrs={
|
||||
"cols": 30,
|
||||
"rows": 5,
|
||||
"class": "w-100"
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user