From 2f3f35250b3315762414ab699b8db843f26305af Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Thu, 3 Jun 2021 18:48:53 +0200 Subject: [PATCH] #334 Unify delete_confirmation and delete_selected_confirmation templates --- chcemvediet/apps/inforequests/admin.py | 5 +++-- .../inforequests/action/delete_confirmation.html | 12 +++++++++--- .../action/delete_selected_confirmation.html | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/chcemvediet/apps/inforequests/admin.py b/chcemvediet/apps/inforequests/admin.py index aeab4891..139fe777 100644 --- a/chcemvediet/apps/inforequests/admin.py +++ b/chcemvediet/apps/inforequests/admin.py @@ -423,8 +423,9 @@ def render_delete_form(self, request, context): obj = context[u'object'] context[u'delete_warnings'] = self.delete_warnings(obj) context[u'delete_constraints'] = self.delete_constraints(obj) - context[u'can_snooze_previous_action'] = self.can_snooze_previous_action(obj) - context[u'ADMIN_EXTEND_SNOOZE_BY_DAYS'] = ADMIN_EXTEND_SNOOZE_BY_DAYS + if self.can_snooze_previous_action(obj): + context[u'snoozed_actions'] = [admin_obj_format(obj.previous_action)] + context[u'ADMIN_EXTEND_SNOOZE_BY_DAYS'] = ADMIN_EXTEND_SNOOZE_BY_DAYS return super(ActionAdmin, self).render_delete_form(request, context) @decorate(short_description=u'Delete selected actions') diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html index 117bce73..dd39fc29 100644 --- a/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html @@ -14,12 +14,18 @@ {% endif %} {% endafter %} - {% if can_snooze_previous_action %} + {% if snoozed_actions %} {% prepend path=".//form" %} -

+

+ +

+ {% endprepend %} {% endif %} - {% before path=".//form" %} + {% before path=".//form//input[@type='submit']" %} {% if delete_warnings %}