use new permission and existence decorator

MK/finance_workflow
Christian Merten 8 months ago
parent 3afcc25bc4
commit 8e9e0f630c
Signed by: christian.merten
GPG Key ID: D953D69721B948B3

@ -370,13 +370,8 @@ class StatementConfirmedAdmin(admin.ModelAdmin):
return render(request, 'admin/unconfirm_statement.html', context=context) return render(request, 'admin/unconfirm_statement.html', context=context)
def statement_summary_view(self, request, object_id): @decorate_statement_view(StatementConfirmed, perm='finance.may_manage_confirmed_statements')
try: def statement_summary_view(self, request, statement):
statement = StatementConfirmed.objects.get(pk=object_id)
except StatementConfirmed.DoesNotExist:
messages.error(request, _('Statement not found.'))
return HttpResponseRedirect(reverse('admin:%s_%s_changelist' % (self.opts.app_label, self.opts.model_name)))
if not statement.confirmed: if not statement.confirmed:
messages.error(request, messages.error(request,
_("%(name)s is not yet confirmed.") % {'name': str(statement)}) _("%(name)s is not yet confirmed.") % {'name': str(statement)})

Loading…
Cancel
Save