Ticket #13743: comments_admin.diff

File comments_admin.diff, 1011 bytes (added by daniellindsley, 5 years ago)

Patch (without tests)

  • django/contrib/comments/admin.py

    diff --git a/django/contrib/comments/admin.py b/django/contrib/comments/admin.py
    index 28678e0..4cb9066 100644
    a b class CommentsAdmin(admin.ModelAdmin): 
    2828    def get_actions(self, request):
    2929        actions = super(CommentsAdmin, self).get_actions(request)
    3030        # Only superusers should be able to delete the comments from the DB.
    31         if not request.user.is_superuser:
     31        if not request.user.is_superuser and 'delete_selected' in actions:
    3232            actions.pop('delete_selected')
    3333        if not request.user.has_perm('comments.can_moderate'):
    34             actions.pop('approve_comments')
    35             actions.pop('remove_comments')
     34            if 'approve_comments' in actions:
     35                actions.pop('approve_comments')
     36            if 'remove_comments' in actions:
     37                actions.pop('remove_comments')
    3638        return actions
    3739
    3840    def flag_comments(self, request, queryset):
Back to Top