Biotope code list
* integrates biotope code list to NewStateForm * adds dal scripts automatically on compensation view
This commit is contained in:
parent
e9aea7bcc4
commit
2469bde7ee
@ -97,11 +97,21 @@ class NewPaymentForm(BaseModalForm):
|
|||||||
|
|
||||||
|
|
||||||
class NewStateModalForm(BaseModalForm):
|
class NewStateModalForm(BaseModalForm):
|
||||||
biotope_type = forms.CharField(
|
biotope_type = forms.ModelChoiceField(
|
||||||
label=_("Biotope Type"),
|
label=_("Biotope Type"),
|
||||||
label_suffix="",
|
label_suffix="",
|
||||||
required=True,
|
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(
|
surface = forms.DecimalField(
|
||||||
min_value=0.00,
|
min_value=0.00,
|
||||||
|
@ -2,7 +2,13 @@
|
|||||||
{% load i18n l10n static fontawesome_5 humanize %}
|
{% load i18n l10n static fontawesome_5 humanize %}
|
||||||
|
|
||||||
{% block head %}
|
{% 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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
@ -18,7 +18,7 @@ from django.contrib import admin
|
|||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
|
|
||||||
from konova.autocompletes import OrganisationAutocomplete, NonOfficialOrganisationAutocomplete, EcoAccountAutocomplete, \
|
from konova.autocompletes import OrganisationAutocomplete, NonOfficialOrganisationAutocomplete, EcoAccountAutocomplete, \
|
||||||
InterventionAutocomplete, CompensationActionCodeAutocomplete
|
InterventionAutocomplete, CompensationActionCodeAutocomplete, BiotopeCodeAutocomplete
|
||||||
from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG
|
from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG
|
||||||
from konova.sso.sso import KonovaSSOClient
|
from konova.sso.sso import KonovaSSOClient
|
||||||
from konova.views import logout_view, home_view, get_document_view, remove_document_view, remove_deadline_view
|
from konova.views import logout_view, home_view, get_document_view, remove_document_view, remove_deadline_view
|
||||||
@ -50,6 +50,7 @@ urlpatterns = [
|
|||||||
path("atcmplt/eco-accounts", EcoAccountAutocomplete.as_view(), name="accounts-autocomplete"),
|
path("atcmplt/eco-accounts", EcoAccountAutocomplete.as_view(), name="accounts-autocomplete"),
|
||||||
path("atcmplt/interventions", InterventionAutocomplete.as_view(), name="interventions-autocomplete"),
|
path("atcmplt/interventions", InterventionAutocomplete.as_view(), name="interventions-autocomplete"),
|
||||||
path("atcmplt/codes/compensation-action", CompensationActionCodeAutocomplete.as_view(), name="codes-compensation-action-autocomplete"),
|
path("atcmplt/codes/compensation-action", CompensationActionCodeAutocomplete.as_view(), name="codes-compensation-action-autocomplete"),
|
||||||
|
path("atcmplt/codes/biotope", BiotopeCodeAutocomplete.as_view(), name="codes-biotope-autocomplete"),
|
||||||
]
|
]
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
The modal wrapper, which can be used on every view can stay on the base.html template
|
The modal wrapper, which can be used on every view can stay on the base.html template
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal">
|
<div class="modal fade" tabindex="-1" role="dialog" id="modal">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog modal-md modal-lg" role="document">
|
||||||
<div class="modal-content"></div>
|
<div class="modal-content"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user