# 129 Handler code renaming

* renames handler code list
* improves missing handler data rendering on detail view
This commit is contained in:
2022-03-03 12:09:09 +01:00
parent c98f41c9a8
commit 22a3339157
12 changed files with 74 additions and 70 deletions

View File

@@ -16,7 +16,7 @@ from django.utils.translation import gettext_lazy as _
from codelist.models import KonovaCode
from codelist.settings import CODELIST_PROCESS_TYPE_ID, CODELIST_LAW_ID, \
CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_COMPENSATION_HANDLER_ID
CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_HANDLER_ID
from intervention.inputs import GenerateInput
from intervention.models import Intervention, Legal, Responsibility, Handler
from konova.forms import BaseForm, SimpleGeomForm
@@ -146,7 +146,7 @@ class NewInterventionForm(BaseForm):
queryset=KonovaCode.objects.filter(
is_archived=False,
is_leaf=True,
code_lists__in=[CODELIST_COMPENSATION_HANDLER_ID],
code_lists__in=[CODELIST_HANDLER_ID],
),
widget=autocomplete.ModelSelect2(
url="codes-handler-autocomplete",

View File

@@ -10,8 +10,9 @@ from django.utils.translation import gettext_lazy as _
from codelist.models import KonovaCode
from codelist.settings import CODELIST_CONSERVATION_OFFICE_ID, CODELIST_REGISTRATION_OFFICE_ID, \
CODELIST_COMPENSATION_HANDLER_ID
CODELIST_HANDLER_ID
from konova.models import UuidModel
from konova.utils.message_templates import UNKNOWN, NO_DETAILS
class Handler(UuidModel):
@@ -26,7 +27,7 @@ class Handler(UuidModel):
null=True,
blank=True,
limit_choices_to={
"code_lists__in": [CODELIST_COMPENSATION_HANDLER_ID],
"code_lists__in": [CODELIST_HANDLER_ID],
"is_selectable": True,
"is_archived": False,
}
@@ -38,8 +39,8 @@ class Handler(UuidModel):
)
def __str__(self):
detail = self.detail or _("no further details")
_type = self.type.long_name if self.type is not None else None
detail = self.detail or NO_DETAILS
_type = self.type.long_name if self.type is not None else UNKNOWN
return f'{_type}, {detail}'