From 05ed481007604079612aa4b0f1f3bb8d4d35a6e5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 10 Sep 2019 18:02:50 +0200 Subject: Locks: prevent edit actions --- ishtar_common/views.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ishtar_common/views.py') diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 2af082a0a..4ab94aae9 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -2110,6 +2110,17 @@ class AlertList(JSONResponseMixin, LoginRequiredMixin, return {'alerts': alerts} +class QANotAvailable(IshtarMixin, LoginRequiredMixin, TemplateView): + template_name = 'ishtar/forms/qa_message.html' + modal_size = "small" + + def get_context_data(self, **kwargs): + data = super(QANotAvailable, self).get_context_data(**kwargs) + data["page_name"] = _("Not available") + data['message'] = _("Action not available for these items.") + return data + + class QAItemForm(IshtarMixin, LoginRequiredMixin, FormView): template_name = 'ishtar/forms/qa_form.html' model = None @@ -2168,6 +2179,10 @@ class QAItemEditForm(QAItemForm): self.confirm = kwargs.get('confirm', False) and True returned = super(QAItemEditForm, self).dispatch(request, *args, **kwargs) + if hasattr(self.model, "locked"): + for item in self.items: + if item.locked: + return HttpResponseRedirect(reverse("qa-not-available")) return returned def get_form_class(self): -- cgit v1.2.3