[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

@@ -11,7 +11,8 @@ from django.utils.timezone import localtime
from django.utils.translation import gettext_lazy as _
from codelist.models import KonovaCode
from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID
from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_LAW_ID, \
CODELIST_PROCESS_TYPE_ID
from konova.models import BaseObject, Geometry, UuidModel, BaseResource
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
from konova.sub_settings.django_settings import DEFAULT_DATE_TIME_FORMAT
@@ -86,8 +87,30 @@ class LegalData(UuidModel):
# Refers to "Bestandskraft am"
binding_date = models.DateField(null=True, blank=True, help_text="Refers to 'Bestandskraft am'")
process_type = models.CharField(max_length=500, null=True, blank=True)
law = models.CharField(max_length=500, null=True, blank=True)
process_type = models.ForeignKey(
KonovaCode,
on_delete=models.SET_NULL,
null=True,
related_name="+",
blank=True,
limit_choices_to={
"code_lists__in": [CODELIST_PROCESS_TYPE_ID],
"is_selectable": True,
"is_archived": False,
}
)
law = models.ForeignKey(
KonovaCode,
on_delete=models.SET_NULL,
null=True,
related_name="+",
blank=True,
limit_choices_to={
"code_lists__in": [CODELIST_LAW_ID],
"is_selectable": True,
"is_archived": False,
}
)
revocation = models.ForeignKey(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)