[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

@@ -13,7 +13,7 @@ from codelist.models import KonovaCode, KonovaCodeList
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_COMPENSATION_ACTION_ID, CODELIST_COMPENSATION_ACTION_CLASS_ID, CODELIST_COMPENSATION_ADDITIONAL_TYPE_ID, \
CODELIST_COMPENSATION_COMBINATION_ID, CODELIST_BASE_URL
CODELIST_COMPENSATION_COMBINATION_ID, CODELIST_BASE_URL, CODELIST_PROCESS_TYPE_ID
bool_map = {
"true": True,
@@ -36,6 +36,7 @@ class Command(BaseCommand):
CODELIST_COMPENSATION_ACTION_CLASS_ID,
CODELIST_COMPENSATION_ADDITIONAL_TYPE_ID,
CODELIST_COMPENSATION_COMBINATION_ID,
CODELIST_PROCESS_TYPE_ID,
]
self._write_warning("Fetching codes...")
@@ -69,6 +70,7 @@ class Command(BaseCommand):
if items is None:
return
else:
self._write_warning(" --- Found {} subcodes. Process now...".format(len(items)))
for element in items:
children = element.find("items")
_id = element.find("id").text