diff options
-rw-r--r-- | archaeological_finds/forms.py | 6 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 7 | ||||
-rw-r--r-- | archaeological_finds/urls.py | 12 | ||||
-rw-r--r-- | archaeological_finds/views.py | 17 |
4 files changed, 42 insertions, 0 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index fc1816d32..9f8aeb497 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -1161,6 +1161,12 @@ class QAFindBasketModify(QAForm): return self._get_ishtar_user_list(value) +class QAFindTreatmentN1Form(FormSet): + form_label = _("Treatment Many to One") + + def __init__(self, *args, **kwargs): + return HttpResponseRedirect(reverse("treatment_creation_n1", args=self.pk)) + class PreservationForm(CustomForm, ManageOldType): form_label = _("Preservation") form_admin_name = _("Find - 030 - Preservation") diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 583ee405a..7486de076 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1706,6 +1706,13 @@ class Find( rights=["change_find", "change_own_find"], module="warehouse", ), + QuickAction( + url="treatment_creation_n1", + icon_class="fa fa-object-group", + text=_("Treatment many to one"), + target="many", + rights=["change_find", "change_own_find"], + ), QA_LOCK, ] UP_MODEL_QUERY = { diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py index 518a2af7e..5cdb9c045 100644 --- a/archaeological_finds/urls.py +++ b/archaeological_finds/urls.py @@ -233,6 +233,13 @@ urlpatterns = [ kwargs={"model": models.Find}, ), url( + r"^find-qa-treatmentN1/(?P<pks>[0-9-]+)?/$", + check_rights(["change_find", "change_own_find"])( + views.QAFindTreatmentN1View.as_view() + ), + name="find-qa-treatmentN1", + ), + url( r"^treatment_creation/(?P<step>.+)?$", check_rights(["change_find", "change_own_find"])( views.treatment_creation_wizard @@ -247,6 +254,11 @@ urlpatterns = [ name="treatment_creation_n1", ), url( + r"treatmentN1_create/(?P<pk>\d+)$", + views.treatmentN1_create, + name="treatmentN1-create", + ), + url( r"^treatment_creation_1n/(?P<step>.+)?$", check_rights(["change_find", "change_own_find"])( views.treatment_creation_1n_wizard diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index d8fd48353..4d8430359 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -654,6 +654,17 @@ treatment_creation_n1_wizard = wizards.TreatmentN1Wizard.as_view( url_name="treatment_creation_n1", ) + +def treatmentN1_create(request, pk): + if not wizard_is_available(treatment_creation_n1_wizard, models.Treatment): + return HttpResponseRedirect("/") + wizards.TreatmentWizard.session_set_value( + request, "selecfind-treatment_creation_n1", "pk", pk, reset=True + ) + return redirect( + "treatment_creation_n1", kwargs={"step": "file-treatment_creation_n1"} + ) + treatment_1n_wizard_steps = [ ("selecfind-treatment_creation_1n", forms.SingleUpstreamFindFormSelection), ("file-treatment_creation_1n", forms.TreatmentFormFileChoice), @@ -1307,6 +1318,12 @@ class QAFindLockView(QABaseLockView): base_url = "find-qa-lock" +class QAFindTreatmentN1View(QAItemForm): + model = models.Treatment + form_class = forms.QAFindTreatmentN1Form + base_url = "find-qa-treatmentN1" + + def get_geo_items(request, get_polygons, current_right=None): operation_pk = request.GET.get("operation_pk") context_record_pk = request.GET.get("context_record_pk") |