#36 Quality checks
* adds unchecking/unrecording of interventions in case of post-check|post-record editing
This commit is contained in:
@@ -15,7 +15,7 @@ from konova.sub_settings.django_settings import DEFAULT_DATE_FORMAT
|
||||
from konova.utils.documents import remove_document, get_document
|
||||
from konova.utils.generators import generate_qr_code
|
||||
from konova.utils.message_templates import INTERVENTION_INVALID, FORM_INVALID, IDENTIFIER_REPLACED, \
|
||||
DATA_UNSHARED_EXPLANATION
|
||||
DATA_UNSHARED_EXPLANATION, CHECKED_RECORDED_RESET
|
||||
from konova.utils.user_checks import in_group
|
||||
|
||||
|
||||
@@ -270,8 +270,13 @@ def edit_view(request: HttpRequest, id: str):
|
||||
if request.method == "POST":
|
||||
if data_form.is_valid() and geom_form.is_valid():
|
||||
# The data form takes the geom form for processing, as well as the performing user
|
||||
# Save the current state of recorded|checked to inform the user in case of a status reset due to editing
|
||||
i_rec = intervention.recorded is not None
|
||||
i_check = intervention.checked is not None
|
||||
intervention = data_form.save(request.user, geom_form)
|
||||
messages.success(request, _("Intervention {} edited").format(intervention.identifier))
|
||||
if i_check or i_rec:
|
||||
messages.info(request, CHECKED_RECORDED_RESET)
|
||||
return redirect("intervention:detail", id=intervention.id)
|
||||
else:
|
||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||
|
||||
Reference in New Issue
Block a user