From 1fa73b90fbfd0cb50740c15214d1787c529bc38e Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 20 Aug 2020 10:25:42 +0200 Subject: [PATCH] Add message when approving/rejecting comments --- articles/admin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/articles/admin.py b/articles/admin.py index 5d93d06..0b151a2 100644 --- a/articles/admin.py +++ b/articles/admin.py @@ -122,7 +122,9 @@ class CommentAdmin(admin.ModelAdmin): actions = ["approve_comments", "reject_comments"] def approve_comments(self, request, queryset): - queryset.update(status=Comment.APPROVED) + count = queryset.update(status=Comment.APPROVED) + messages.success(request, f"Approved {count} message(s).") def reject_comments(self, request, queryset): - queryset.update(status=Comment.REJECTED) + count = queryset.update(status=Comment.REJECTED) + messages.success(request, f"Rejected {count} message(s).")