Compare commits
No commits in common. "d72c29bd562b9c285e474dcf70d29091e91193b9" and "c1a251abc9b0c25100b56901d8821aadb4fe9cfc" have entirely different histories.
d72c29bd56
...
c1a251abc9
@ -13,7 +13,7 @@ from codelist.models import KonovaCode, KonovaCodeList
|
|||||||
from codelist.settings import CODELIST_INTERVENTION_HANDLER_ID, CODELIST_CONSERVATION_OFFICE_ID, \
|
from codelist.settings import CODELIST_INTERVENTION_HANDLER_ID, CODELIST_CONSERVATION_OFFICE_ID, \
|
||||||
CODELIST_REGISTRATION_OFFICE_ID, CODELIST_BIOTOPES_ID, CODELIST_LAW_ID, CODELIST_COMPENSATION_HANDLER_ID, \
|
CODELIST_REGISTRATION_OFFICE_ID, CODELIST_BIOTOPES_ID, CODELIST_LAW_ID, CODELIST_COMPENSATION_HANDLER_ID, \
|
||||||
CODELIST_COMPENSATION_ACTION_ID, CODELIST_COMPENSATION_ACTION_CLASS_ID, CODELIST_COMPENSATION_ADDITIONAL_TYPE_ID, \
|
CODELIST_COMPENSATION_ACTION_ID, CODELIST_COMPENSATION_ACTION_CLASS_ID, CODELIST_COMPENSATION_ADDITIONAL_TYPE_ID, \
|
||||||
CODELIST_BASE_URL, CODELIST_PROCESS_TYPE_ID
|
CODELIST_COMPENSATION_FUNDING_ID, CODELIST_BASE_URL, CODELIST_PROCESS_TYPE_ID
|
||||||
from konova.management.commands.setup import BaseKonovaCommand
|
from konova.management.commands.setup import BaseKonovaCommand
|
||||||
|
|
||||||
bool_map = {
|
bool_map = {
|
||||||
@ -37,6 +37,7 @@ class Command(BaseKonovaCommand):
|
|||||||
CODELIST_COMPENSATION_ACTION_ID,
|
CODELIST_COMPENSATION_ACTION_ID,
|
||||||
CODELIST_COMPENSATION_ACTION_CLASS_ID,
|
CODELIST_COMPENSATION_ACTION_CLASS_ID,
|
||||||
CODELIST_COMPENSATION_ADDITIONAL_TYPE_ID,
|
CODELIST_COMPENSATION_ADDITIONAL_TYPE_ID,
|
||||||
|
CODELIST_COMPENSATION_FUNDING_ID,
|
||||||
CODELIST_PROCESS_TYPE_ID,
|
CODELIST_PROCESS_TYPE_ID,
|
||||||
]
|
]
|
||||||
self._write_warning("Fetching codes...")
|
self._write_warning("Fetching codes...")
|
||||||
|
@ -13,7 +13,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from codelist.models import KonovaCode
|
from codelist.models import KonovaCode
|
||||||
from codelist.settings import CODELIST_CONSERVATION_OFFICE_ID
|
from codelist.settings import CODELIST_COMPENSATION_FUNDING_ID, CODELIST_CONSERVATION_OFFICE_ID
|
||||||
from compensation.models import Compensation, EcoAccount
|
from compensation.models import Compensation, EcoAccount
|
||||||
from intervention.inputs import GenerateInput
|
from intervention.inputs import GenerateInput
|
||||||
from intervention.models import Intervention, ResponsibilityData, LegalData
|
from intervention.models import Intervention, ResponsibilityData, LegalData
|
||||||
@ -51,6 +51,23 @@ class AbstractCompensationForm(BaseForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
fundings = forms.ModelMultipleChoiceField(
|
||||||
|
label=_("Fundings"),
|
||||||
|
label_suffix="",
|
||||||
|
required=False,
|
||||||
|
help_text=_("Select fundings for this compensation"),
|
||||||
|
queryset=KonovaCode.objects.filter(
|
||||||
|
is_archived=False,
|
||||||
|
is_leaf=True,
|
||||||
|
code_lists__in=[CODELIST_COMPENSATION_FUNDING_ID],
|
||||||
|
),
|
||||||
|
widget=autocomplete.ModelSelect2Multiple(
|
||||||
|
url="codes-compensation-funding-autocomplete",
|
||||||
|
attrs={
|
||||||
|
"data-placeholder": _("Click for selection"),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
comment = forms.CharField(
|
comment = forms.CharField(
|
||||||
label_suffix="",
|
label_suffix="",
|
||||||
label=_("Comment"),
|
label=_("Comment"),
|
||||||
@ -146,6 +163,7 @@ class NewCompensationForm(AbstractCompensationForm):
|
|||||||
"identifier",
|
"identifier",
|
||||||
"title",
|
"title",
|
||||||
"intervention",
|
"intervention",
|
||||||
|
"fundings",
|
||||||
"comment",
|
"comment",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -176,6 +194,7 @@ class NewCompensationForm(AbstractCompensationForm):
|
|||||||
# Fetch data from cleaned POST values
|
# Fetch data from cleaned POST values
|
||||||
identifier = self.cleaned_data.get("identifier", None)
|
identifier = self.cleaned_data.get("identifier", None)
|
||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
intervention = self.cleaned_data.get("intervention", None)
|
intervention = self.cleaned_data.get("intervention", None)
|
||||||
comment = self.cleaned_data.get("comment", None)
|
comment = self.cleaned_data.get("comment", None)
|
||||||
|
|
||||||
@ -196,6 +215,7 @@ class NewCompensationForm(AbstractCompensationForm):
|
|||||||
geometry=geometry,
|
geometry=geometry,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
)
|
)
|
||||||
|
comp.fundings.set(fundings)
|
||||||
|
|
||||||
# Add the log entry to the main objects log list
|
# Add the log entry to the main objects log list
|
||||||
comp.log.add(action)
|
comp.log.add(action)
|
||||||
@ -217,6 +237,7 @@ class EditCompensationForm(NewCompensationForm):
|
|||||||
"identifier": self.instance.identifier,
|
"identifier": self.instance.identifier,
|
||||||
"title": self.instance.title,
|
"title": self.instance.title,
|
||||||
"intervention": self.instance.intervention,
|
"intervention": self.instance.intervention,
|
||||||
|
"fundings": self.instance.fundings.all(),
|
||||||
"comment": self.instance.comment,
|
"comment": self.instance.comment,
|
||||||
}
|
}
|
||||||
disabled_fields = []
|
disabled_fields = []
|
||||||
@ -230,6 +251,7 @@ class EditCompensationForm(NewCompensationForm):
|
|||||||
# Fetch data from cleaned POST values
|
# Fetch data from cleaned POST values
|
||||||
identifier = self.cleaned_data.get("identifier", None)
|
identifier = self.cleaned_data.get("identifier", None)
|
||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
intervention = self.cleaned_data.get("intervention", None)
|
intervention = self.cleaned_data.get("intervention", None)
|
||||||
comment = self.cleaned_data.get("comment", None)
|
comment = self.cleaned_data.get("comment", None)
|
||||||
|
|
||||||
@ -249,6 +271,7 @@ class EditCompensationForm(NewCompensationForm):
|
|||||||
self.instance.geometry = geometry
|
self.instance.geometry = geometry
|
||||||
self.instance.comment = comment
|
self.instance.comment = comment
|
||||||
self.instance.modified = action
|
self.instance.modified = action
|
||||||
|
self.instance.fundings.set(fundings)
|
||||||
self.instance.save()
|
self.instance.save()
|
||||||
|
|
||||||
self.instance.log.add(action)
|
self.instance.log.add(action)
|
||||||
@ -297,6 +320,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
"surface",
|
"surface",
|
||||||
"conservation_file_number",
|
"conservation_file_number",
|
||||||
"handler",
|
"handler",
|
||||||
|
"fundings",
|
||||||
"comment",
|
"comment",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -318,6 +342,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
# Fetch data from cleaned POST values
|
# Fetch data from cleaned POST values
|
||||||
identifier = self.cleaned_data.get("identifier", None)
|
identifier = self.cleaned_data.get("identifier", None)
|
||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
registration_date = self.cleaned_data.get("registration_date", None)
|
registration_date = self.cleaned_data.get("registration_date", None)
|
||||||
handler = self.cleaned_data.get("handler", None)
|
handler = self.cleaned_data.get("handler", None)
|
||||||
surface = self.cleaned_data.get("surface", None)
|
surface = self.cleaned_data.get("surface", None)
|
||||||
@ -354,6 +379,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
comment=comment,
|
comment=comment,
|
||||||
legal=legal
|
legal=legal
|
||||||
)
|
)
|
||||||
|
acc.fundings.set(fundings)
|
||||||
acc.share_with(user)
|
acc.share_with(user)
|
||||||
|
|
||||||
# Add the log entry to the main objects log list
|
# Add the log entry to the main objects log list
|
||||||
@ -385,6 +411,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
|||||||
"registration_date": reg_date,
|
"registration_date": reg_date,
|
||||||
"conservation_office": self.instance.responsible.conservation_office,
|
"conservation_office": self.instance.responsible.conservation_office,
|
||||||
"conservation_file_number": self.instance.responsible.conservation_file_number,
|
"conservation_file_number": self.instance.responsible.conservation_file_number,
|
||||||
|
"fundings": self.instance.fundings.all(),
|
||||||
"comment": self.instance.comment,
|
"comment": self.instance.comment,
|
||||||
}
|
}
|
||||||
disabled_fields = []
|
disabled_fields = []
|
||||||
@ -398,6 +425,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
|||||||
# Fetch data from cleaned POST values
|
# Fetch data from cleaned POST values
|
||||||
identifier = self.cleaned_data.get("identifier", None)
|
identifier = self.cleaned_data.get("identifier", None)
|
||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
registration_date = self.cleaned_data.get("registration_date", None)
|
registration_date = self.cleaned_data.get("registration_date", None)
|
||||||
handler = self.cleaned_data.get("handler", None)
|
handler = self.cleaned_data.get("handler", None)
|
||||||
surface = self.cleaned_data.get("surface", None)
|
surface = self.cleaned_data.get("surface", None)
|
||||||
@ -431,6 +459,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
|||||||
self.instance.comment = comment
|
self.instance.comment = comment
|
||||||
self.instance.modified = action
|
self.instance.modified = action
|
||||||
self.instance.save()
|
self.instance.save()
|
||||||
|
self.instance.fundings.set(fundings)
|
||||||
|
|
||||||
# Add the log entry to the main objects log list
|
# Add the log entry to the main objects log list
|
||||||
self.instance.log.add(action)
|
self.instance.log.add(action)
|
||||||
|
@ -15,7 +15,8 @@ from django.db.models import Sum, QuerySet
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from codelist.models import KonovaCode
|
from codelist.models import KonovaCode
|
||||||
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_BIOTOPES_ID
|
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_BIOTOPES_ID, \
|
||||||
|
CODELIST_COMPENSATION_FUNDING_ID
|
||||||
from compensation.managers import CompensationStateManager, EcoAccountDeductionManager, CompensationActionManager, \
|
from compensation.managers import CompensationStateManager, EcoAccountDeductionManager, CompensationActionManager, \
|
||||||
EcoAccountManager, CompensationManager
|
EcoAccountManager, CompensationManager
|
||||||
from compensation.utils.quality import CompensationQualityChecker, EcoAccountQualityChecker
|
from compensation.utils.quality import CompensationQualityChecker, EcoAccountQualityChecker
|
||||||
@ -145,6 +146,17 @@ class AbstractCompensation(BaseObject):
|
|||||||
after_states = models.ManyToManyField(CompensationState, blank=True, related_name='+', help_text="Refers to 'Zielzustand Biotop'")
|
after_states = models.ManyToManyField(CompensationState, blank=True, related_name='+', help_text="Refers to 'Zielzustand Biotop'")
|
||||||
actions = models.ManyToManyField(CompensationAction, blank=True, help_text="Refers to 'Maßnahmen'")
|
actions = models.ManyToManyField(CompensationAction, blank=True, help_text="Refers to 'Maßnahmen'")
|
||||||
|
|
||||||
|
fundings = models.ManyToManyField(
|
||||||
|
KonovaCode,
|
||||||
|
blank=True,
|
||||||
|
limit_choices_to={
|
||||||
|
"code_lists__in": [CODELIST_COMPENSATION_FUNDING_ID],
|
||||||
|
"is_selectable": True,
|
||||||
|
"is_archived": False,
|
||||||
|
},
|
||||||
|
help_text="List of funding project codes",
|
||||||
|
)
|
||||||
|
|
||||||
deadlines = models.ManyToManyField("konova.Deadline", blank=True, related_name="+")
|
deadlines = models.ManyToManyField("konova.Deadline", blank=True, related_name="+")
|
||||||
|
|
||||||
geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL)
|
geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL)
|
||||||
|
@ -66,6 +66,19 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% for funding in obj.fundings.all %}
|
||||||
|
<div class="badge badge-pill rlp-r-outline">
|
||||||
|
{{ funding.short_name}}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Last modified' %}</th>
|
<th scope="row">{% trans 'Last modified' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -69,6 +69,19 @@
|
|||||||
<th scope="row">{% trans 'Action handler' %}</th>
|
<th scope="row">{% trans 'Action handler' %}</th>
|
||||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% for funding in obj.fundings.all %}
|
||||||
|
<div class="badge badge-pill rlp-r-outline">
|
||||||
|
{{ funding.short_name}}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Last modified' %}</th>
|
<th scope="row">{% trans 'Last modified' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -20,6 +20,19 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% with obj.fundings.all as fundings %}
|
||||||
|
{% for funding in fundings %}
|
||||||
|
<div class="badge pill-badge rlp-r-outline">{{funding.short_name}}</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Last modified' %}</th>
|
<th scope="row">{% trans 'Last modified' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -24,6 +24,19 @@
|
|||||||
<th scope="row">{% trans 'Action handler' %}</th>
|
<th scope="row">{% trans 'Action handler' %}</th>
|
||||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% with obj.fundings.all as fundings %}
|
||||||
|
{% for funding in fundings %}
|
||||||
|
<div class="badge pill-badge rlp-r-outline">{{funding.short_name}}</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Deductions for' %}</th>
|
<th scope="row">{% trans 'Deductions for' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -5,13 +5,10 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
|||||||
Created on: 06.10.21
|
Created on: 06.10.21
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from dal import autocomplete
|
|
||||||
from django import forms
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from compensation.forms.forms import AbstractCompensationForm, CompensationResponsibleFormMixin
|
from compensation.forms.forms import AbstractCompensationForm, CompensationResponsibleFormMixin
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from intervention.models import ResponsibilityData
|
from intervention.models import ResponsibilityData
|
||||||
@ -32,6 +29,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
|||||||
"conservation_office",
|
"conservation_office",
|
||||||
"conservation_file_number",
|
"conservation_file_number",
|
||||||
"handler",
|
"handler",
|
||||||
|
"fundings",
|
||||||
"comment",
|
"comment",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -53,6 +51,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
|||||||
# Fetch data from cleaned POST values
|
# Fetch data from cleaned POST values
|
||||||
identifier = self.cleaned_data.get("identifier", None)
|
identifier = self.cleaned_data.get("identifier", None)
|
||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
handler = self.cleaned_data.get("handler", None)
|
handler = self.cleaned_data.get("handler", None)
|
||||||
conservation_office = self.cleaned_data.get("conservation_office", None)
|
conservation_office = self.cleaned_data.get("conservation_office", None)
|
||||||
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
||||||
@ -81,6 +80,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
|||||||
geometry=geometry,
|
geometry=geometry,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
)
|
)
|
||||||
|
acc.fundings.set(fundings)
|
||||||
|
|
||||||
# Add the creating user to the list of shared users
|
# Add the creating user to the list of shared users
|
||||||
acc.share_with(user)
|
acc.share_with(user)
|
||||||
@ -111,6 +111,7 @@ class EditEmaForm(NewEmaForm):
|
|||||||
"handler": self.instance.responsible.handler,
|
"handler": self.instance.responsible.handler,
|
||||||
"conservation_office": self.instance.responsible.conservation_office,
|
"conservation_office": self.instance.responsible.conservation_office,
|
||||||
"conservation_file_number": self.instance.responsible.conservation_file_number,
|
"conservation_file_number": self.instance.responsible.conservation_file_number,
|
||||||
|
"fundings": self.instance.fundings.all(),
|
||||||
"comment": self.instance.comment,
|
"comment": self.instance.comment,
|
||||||
}
|
}
|
||||||
disabled_fields = []
|
disabled_fields = []
|
||||||
@ -124,6 +125,7 @@ class EditEmaForm(NewEmaForm):
|
|||||||
# Fetch data from cleaned POST values
|
# Fetch data from cleaned POST values
|
||||||
identifier = self.cleaned_data.get("identifier", None)
|
identifier = self.cleaned_data.get("identifier", None)
|
||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
handler = self.cleaned_data.get("handler", None)
|
handler = self.cleaned_data.get("handler", None)
|
||||||
conservation_office = self.cleaned_data.get("conservation_office", None)
|
conservation_office = self.cleaned_data.get("conservation_office", None)
|
||||||
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
||||||
@ -150,6 +152,7 @@ class EditEmaForm(NewEmaForm):
|
|||||||
self.instance.comment = comment
|
self.instance.comment = comment
|
||||||
self.instance.modified = action
|
self.instance.modified = action
|
||||||
self.instance.save()
|
self.instance.save()
|
||||||
|
self.instance.fundings.set(fundings)
|
||||||
|
|
||||||
# Add the log entry to the main objects log list
|
# Add the log entry to the main objects log list
|
||||||
self.instance.log.add(action)
|
self.instance.log.add(action)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
|
|
||||||
|
@ -50,6 +50,19 @@
|
|||||||
<th scope="row">{% trans 'Action handler' %}</th>
|
<th scope="row">{% trans 'Action handler' %}</th>
|
||||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% for funding in obj.fundings.all %}
|
||||||
|
<div class="badge badge-pill rlp-r-outline">
|
||||||
|
{{ funding.short_name}}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Last modified' %}</th>
|
<th scope="row">{% trans 'Last modified' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -24,6 +24,19 @@
|
|||||||
<th scope="row">{% trans 'Action handler' %}</th>
|
<th scope="row">{% trans 'Action handler' %}</th>
|
||||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% with obj.fundings.all as fundings %}
|
||||||
|
{% for funding in fundings %}
|
||||||
|
<div class="badge pill-badge rlp-r-outline">{{funding.short_name}}</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Last modified' %}</th>
|
<th scope="row">{% trans 'Last modified' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -10,7 +10,8 @@ from django.db.models import Q
|
|||||||
|
|
||||||
from codelist.models import KonovaCode
|
from codelist.models import KonovaCode
|
||||||
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_BIOTOPES_ID, CODELIST_LAW_ID, \
|
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_BIOTOPES_ID, CODELIST_LAW_ID, \
|
||||||
CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_PROCESS_TYPE_ID
|
CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_PROCESS_TYPE_ID, \
|
||||||
|
CODELIST_COMPENSATION_FUNDING_ID
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
|
|
||||||
@ -108,6 +109,15 @@ class CompensationActionCodeAutocomplete(KonovaCodeAutocomplete):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class CompensationFundingCodeAutocomplete(KonovaCodeAutocomplete):
|
||||||
|
"""
|
||||||
|
Due to limitations of the django dal package, we need to subclass for each code list
|
||||||
|
"""
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.c = CODELIST_COMPENSATION_FUNDING_ID
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class BiotopeCodeAutocomplete(KonovaCodeAutocomplete):
|
class BiotopeCodeAutocomplete(KonovaCodeAutocomplete):
|
||||||
"""
|
"""
|
||||||
Due to limitations of the django dal package, we need to subclass for each code list
|
Due to limitations of the django dal package, we need to subclass for each code list
|
||||||
|
@ -408,6 +408,7 @@ class AutocompleteTestCase(BaseViewTestCase):
|
|||||||
cls.atcmplt_accs = reverse("accounts-autocomplete")
|
cls.atcmplt_accs = reverse("accounts-autocomplete")
|
||||||
cls.atcmplt_interventions = reverse("interventions-autocomplete")
|
cls.atcmplt_interventions = reverse("interventions-autocomplete")
|
||||||
cls.atcmplt_code_comp_action = reverse("codes-compensation-action-autocomplete")
|
cls.atcmplt_code_comp_action = reverse("codes-compensation-action-autocomplete")
|
||||||
|
cls.atcmplt_code_comp_funding = reverse("codes-compensation-funding-autocomplete")
|
||||||
cls.atcmplt_code_comp_biotope = reverse("codes-biotope-autocomplete")
|
cls.atcmplt_code_comp_biotope = reverse("codes-biotope-autocomplete")
|
||||||
cls.atcmplt_code_comp_law = reverse("codes-law-autocomplete")
|
cls.atcmplt_code_comp_law = reverse("codes-law-autocomplete")
|
||||||
cls.atcmplt_code_comp_process = reverse("codes-process-type-autocomplete")
|
cls.atcmplt_code_comp_process = reverse("codes-process-type-autocomplete")
|
||||||
@ -425,6 +426,7 @@ class AutocompleteTestCase(BaseViewTestCase):
|
|||||||
self.atcmplt_accs,
|
self.atcmplt_accs,
|
||||||
self.atcmplt_interventions,
|
self.atcmplt_interventions,
|
||||||
self.atcmplt_code_comp_action,
|
self.atcmplt_code_comp_action,
|
||||||
|
self.atcmplt_code_comp_funding,
|
||||||
self.atcmplt_code_comp_biotope,
|
self.atcmplt_code_comp_biotope,
|
||||||
self.atcmplt_code_comp_law,
|
self.atcmplt_code_comp_law,
|
||||||
self.atcmplt_code_comp_process,
|
self.atcmplt_code_comp_process,
|
||||||
@ -442,6 +444,7 @@ class AutocompleteTestCase(BaseViewTestCase):
|
|||||||
self.atcmplt_accs,
|
self.atcmplt_accs,
|
||||||
self.atcmplt_interventions,
|
self.atcmplt_interventions,
|
||||||
self.atcmplt_code_comp_action,
|
self.atcmplt_code_comp_action,
|
||||||
|
self.atcmplt_code_comp_funding,
|
||||||
self.atcmplt_code_comp_biotope,
|
self.atcmplt_code_comp_biotope,
|
||||||
self.atcmplt_code_comp_law,
|
self.atcmplt_code_comp_law,
|
||||||
self.atcmplt_code_comp_process,
|
self.atcmplt_code_comp_process,
|
||||||
|
@ -19,7 +19,8 @@ from django.urls import path, include
|
|||||||
|
|
||||||
from konova.autocompletes import EcoAccountAutocomplete, \
|
from konova.autocompletes import EcoAccountAutocomplete, \
|
||||||
InterventionAutocomplete, CompensationActionCodeAutocomplete, BiotopeCodeAutocomplete, LawCodeAutocomplete, \
|
InterventionAutocomplete, CompensationActionCodeAutocomplete, BiotopeCodeAutocomplete, LawCodeAutocomplete, \
|
||||||
RegistrationOfficeCodeAutocomplete, ConservationOfficeCodeAutocomplete, ProcessTypeCodeAutocomplete
|
RegistrationOfficeCodeAutocomplete, ConservationOfficeCodeAutocomplete, ProcessTypeCodeAutocomplete, \
|
||||||
|
CompensationFundingCodeAutocomplete
|
||||||
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, remove_deadline_view
|
from konova.views import logout_view, home_view, remove_deadline_view
|
||||||
@ -45,6 +46,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/comp/action", CompensationActionCodeAutocomplete.as_view(), name="codes-compensation-action-autocomplete"),
|
path("atcmplt/codes/comp/action", CompensationActionCodeAutocomplete.as_view(), name="codes-compensation-action-autocomplete"),
|
||||||
|
path("atcmplt/codes/comp/funding", CompensationFundingCodeAutocomplete.as_view(), name="codes-compensation-funding-autocomplete"),
|
||||||
path("atcmplt/codes/biotope", BiotopeCodeAutocomplete.as_view(), name="codes-biotope-autocomplete"),
|
path("atcmplt/codes/biotope", BiotopeCodeAutocomplete.as_view(), name="codes-biotope-autocomplete"),
|
||||||
path("atcmplt/codes/law", LawCodeAutocomplete.as_view(), name="codes-law-autocomplete"),
|
path("atcmplt/codes/law", LawCodeAutocomplete.as_view(), name="codes-law-autocomplete"),
|
||||||
path("atcmplt/codes/prc-type", ProcessTypeCodeAutocomplete.as_view(), name="codes-process-type-autocomplete"),
|
path("atcmplt/codes/prc-type", ProcessTypeCodeAutocomplete.as_view(), name="codes-process-type-autocomplete"),
|
||||||
|
Loading…
Reference in New Issue
Block a user