#18 EcoAccount funding

* adds fundings field to AbstractCompensation model
* adds funded by to detail view templates of Compensation and EcoAccount
* adds/updates translations
This commit is contained in:
mipel
2021-09-20 12:47:55 +02:00
parent df4052ac00
commit 7612b1eab2
5 changed files with 60 additions and 15 deletions

View File

@@ -15,7 +15,8 @@ from django.db.models import Sum, QuerySet
from django.utils.translation import gettext_lazy as _
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_COMBINATION_ID
from intervention.models import Intervention, ResponsibilityData
from konova.models import BaseObject, BaseResource, Geometry, UuidModel, AbstractDocument, \
generate_document_file_upload_path
@@ -138,6 +139,18 @@ class AbstractCompensation(BaseObject):
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'")
fundings = models.ManyToManyField(
KonovaCode,
null=True,
blank=True,
limit_choices_to={
"code_lists__in": [CODELIST_COMPENSATION_COMBINATION_ID],
"is_selectable": True,
"is_archived": False,
},
help_text="List of funding project codes",
)
deadlines = models.ManyToManyField("konova.Deadline", blank=True, related_name="+")
geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL)

View File

@@ -66,6 +66,19 @@
{% endif %}
</td>
</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 %}
None
{% endfor %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Last modified' %}</th>
<td class="align-middle">

View File

@@ -65,6 +65,19 @@
<th scope="row">{% trans 'Intervention handler' %}</th>
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
</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>
<th scope="row">{% trans 'Last modified' %}</th>
<td class="align-middle">