Add message when approving/rejecting comments

This commit is contained in:
Gabriel Augendre 2020-08-20 10:25:42 +02:00
parent fbfceecc93
commit 1fa73b90fb

View file

@ -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).")