Biotope code list
* integrates biotope code list to NewStateForm * adds dal scripts automatically on compensation view
This commit is contained in:
@@ -97,11 +97,21 @@ class NewPaymentForm(BaseModalForm):
|
||||
|
||||
|
||||
class NewStateModalForm(BaseModalForm):
|
||||
biotope_type = forms.CharField(
|
||||
biotope_type = forms.ModelChoiceField(
|
||||
label=_("Biotope Type"),
|
||||
label_suffix="",
|
||||
required=True,
|
||||
help_text=_("Select the biotope type")
|
||||
help_text=_("Select the biotope type"),
|
||||
queryset=KonovaCode.objects.filter(
|
||||
is_active=True,
|
||||
),
|
||||
widget=autocomplete.ModelSelect2(
|
||||
url="codes-biotope-autocomplete",
|
||||
attrs={
|
||||
"data-placeholder": _("Biotope Type"),
|
||||
"data-minimum-input-length": 3,
|
||||
}
|
||||
),
|
||||
)
|
||||
surface = forms.DecimalField(
|
||||
min_value=0.00,
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
{% load i18n l10n static fontawesome_5 humanize %}
|
||||
|
||||
{% block head %}
|
||||
|
||||
{% comment %}
|
||||
dal documentation (django-autocomplete-light) states using form.media for adding needed scripts.
|
||||
This does not work properly with modal forms, as the scripts are not loaded properly inside the modal.
|
||||
Therefore the script linkages from form.media have been extracted and put inside dal/scripts.html to ensure
|
||||
these scripts are loaded when needed.
|
||||
{% endcomment %}
|
||||
{% include 'dal/scripts.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
Reference in New Issue
Block a user