From f4a2d8821c8fbd5aa6d328660c76b499d2b8741c Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Mon, 10 May 2021 10:03:15 +0200 Subject: [PATCH] #334 Disable branch delete button --- chcemvediet/apps/inforequests/admin.py | 8 ++++---- .../admin/inforequests/branch/delete_confirmation.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chcemvediet/apps/inforequests/admin.py b/chcemvediet/apps/inforequests/admin.py index 2900a387..5f478cf2 100644 --- a/chcemvediet/apps/inforequests/admin.py +++ b/chcemvediet/apps/inforequests/admin.py @@ -385,14 +385,14 @@ def get_inforequest(self, obj): return obj.branch.inforequest def delete_constraints(self, obj): - dependency = [] + constraints = [] if obj.type in [Action.TYPES.REQUEST, Action.TYPES.ADVANCED_REQUEST]: - dependency.append(format_html( + constraints.append(format_html( u'{} is type {}.'.format(admin_obj_format(obj), obj.get_type_display()))) if len(obj.branch.actions) == 1: - dependency.append(format_html( + constraints.append(format_html( u'{} is the only action in the branch.'.format(admin_obj_format(obj)))) - return dependency + return constraints def render_delete_form(self, request, context): context[u'delete_constraints'] = self.delete_constraints(context[u'object']) diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html index e1af2ba5..94983660 100644 --- a/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html @@ -21,7 +21,7 @@ {% endbefore %} - {% set_attributes path=".//form//input[@type='submit']" disabled=False %} + {% set_attributes path=".//form//input[@type='submit']" disabled=True %} {% endif %} {% endamend %} {% endblock %}