# Unit test konova app
* adds unit test for konova app models * drops unused/unnecessary code fragments * updates translation
This commit is contained in:
@@ -25,7 +25,7 @@ from konova.forms.modals import RemoveModalForm
|
||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE, DATA_CHECKED_PREVIOUSLY_TEMPLATE, \
|
||||
RECORDED_BLOCKS_EDIT, CHECKED_RECORDED_RESET, FORM_INVALID, PARAMS_INVALID, IDENTIFIER_REPLACED, \
|
||||
RECORDED_BLOCKS_EDIT, CHECK_STATE_RESET, FORM_INVALID, PARAMS_INVALID, IDENTIFIER_REPLACED, \
|
||||
COMPENSATION_ADDED_TEMPLATE, DO_NOT_FORGET_TO_SHARE, GEOMETRY_SIMPLIFIED
|
||||
from konova.utils.user_checks import in_group
|
||||
|
||||
@@ -170,15 +170,14 @@ def edit_view(request: HttpRequest, id: str):
|
||||
geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=comp)
|
||||
if request.method == "POST":
|
||||
if data_form.is_valid() and geom_form.is_valid():
|
||||
# Preserve state of intervention recorded/checked to determine whether the user must be informed or not
|
||||
# about a change of the recorded/checked state
|
||||
intervention_recorded = comp.intervention.recorded is not None
|
||||
intervention_checked = comp.intervention.checked is not None
|
||||
# Preserve state of intervention checked to determine whether the user must be informed or not
|
||||
# about a change of the check state
|
||||
intervention_is_checked = comp.intervention.checked is not None
|
||||
|
||||
# The data form takes the geom form for processing, as well as the performing user
|
||||
comp = data_form.save(request.user, geom_form)
|
||||
if intervention_recorded or intervention_checked:
|
||||
messages.info(request, CHECKED_RECORDED_RESET)
|
||||
if intervention_is_checked:
|
||||
messages.info(request, CHECK_STATE_RESET)
|
||||
messages.success(request, _("Compensation {} edited").format(comp.identifier))
|
||||
if geom_form.geometry_simplified:
|
||||
messages.info(
|
||||
|
||||
Reference in New Issue
Block a user