Ticket #12940: 12940.txt

File 12940.txt, 2.2 KB (added by Alexey Boriskin, 14 years ago)
Line 
1Index: contrib/comments/admin.py
2===================================================================
3--- contrib/comments/admin.py (revision 12508)
4+++ contrib/comments/admin.py (working copy)
5@@ -36,18 +36,21 @@
6 return actions
7
8 def flag_comments(self, request, queryset):
9- self._bulk_flag(request, queryset, perform_flag, _("flagged"))
10+ self._bulk_flag(request, queryset, perform_flag, lambda n: ungettext('flagged',\
11+ 'flagged', n))
12 flag_comments.short_description = _("Flag selected comments")
13
14 def approve_comments(self, request, queryset):
15- self._bulk_flag(request, queryset, perform_approve, _('approved'))
16+ self._bulk_flag(request, queryset, perform_approve, lambda n: ungettext('approved',\
17+ 'approved', n))
18 approve_comments.short_description = _("Approve selected comments")
19
20 def remove_comments(self, request, queryset):
21- self._bulk_flag(request, queryset, perform_delete, _('removed'))
22+ self._bulk_flag(request, queryset, perform_delete, lambda n: ungettext('removed',\
23+ 'removed', n))
24 remove_comments.short_description = _("Remove selected comments")
25
26- def _bulk_flag(self, request, queryset, action, description):
27+ def _bulk_flag(self, request, queryset, action, done_message):
28 """
29 Flag, approve, or remove some comments from an admin action. Actually
30 calls the `action` argument to perform the heavy lifting.
31@@ -60,7 +63,7 @@
32 msg = ungettext(u'1 comment was successfully %(action)s.',
33 u'%(count)s comments were successfully %(action)s.',
34 n_comments)
35- self.message_user(request, msg % {'count': n_comments, 'action': description})
36+ self.message_user(request, msg % {'count': n_comments, 'action': done_message(n_comments)})
37
38 # Only register the default admin if the model is the built-in comment model
39 # (this won't be true if there's a custom comment app).
Back to Top