[Compensation] Conservation office #5

* keeps responsible data in compensation model for potential future purposes
* refactors registration_office and conservation_office to map onto KonovaCodes instead of own Organization model
* adds str_as_office property-method to KonovaCode to provide an easy way of rendering template data
* adds missing highlighting in case of missing information about registration office and conservation office
* extends KonovaCode command update_codelist.py for CODELIST_PROCESS_TYPE_ID
* adds preselectors for konova codes in models of CompensationAction, Law and CompensationState
This commit is contained in:
mipel
2021-08-27 15:16:05 +02:00
parent e35dc6f2a5
commit dc0137b2a2
5 changed files with 54 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ from django.db.models import Sum
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 intervention.models import Intervention, ResponsibilityData
from konova.models import BaseObject, BaseResource, Geometry, UuidModel
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
@@ -52,7 +53,12 @@ class CompensationState(UuidModel):
KonovaCode,
on_delete=models.SET_NULL,
null=True,
blank=True
blank=True,
limit_choices_to={
"code_lists__in": [CODELIST_BIOTOPES_ID],
"is_selectable": True,
"is_archived": False,
}
)
surface = models.FloatField()
@@ -80,7 +86,12 @@ class CompensationAction(BaseResource):
KonovaCode,
on_delete=models.SET_NULL,
null=True,
blank=True
blank=True,
limit_choices_to={
"code_lists__in": [CODELIST_COMPENSATION_ACTION_ID],
"is_selectable": True,
"is_archived": False,
}
)
amount = models.FloatField()
unit = models.CharField(max_length=100, null=True, blank=True, choices=UnitChoices.choices)