Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5842605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:02:22+00:00 2026-05-22T12:02:22+00:00

I recently upgraded a large Django install from 1.1 to 1.3. In the Comments

  • 0

I recently upgraded a large Django install from 1.1 to 1.3. In the Comments app, they added a caveat so only Superusers get the Delete Action.

The moderators, who have permissions to Delete, as a result don’t see those Actions. This is really inconvenient for them.

The code in question is in contrib.comments.admin starting on line 28:

def get_actions(self, request):
    actions = super(CommentsAdmin, self).get_actions(request)
    # Only superusers should be able to delete the comments from the DB.
    if not request.user.is_superuser and 'delete_selected' in actions:
        actions.pop('delete_selected')

It should instead ask if request.user has delete permissions.

How can I override this without jacking with the actual Django install?

(And if anyone knows why this was changed, I’d be interested to know.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:02:23+00:00Added an answer on May 22, 2026 at 12:02 pm

    In the comments app, there is a “Remove selected comments” action. When you apply the this action, it ‘marks’ the comment as deleted instead of deleting from the database — it creates a deleted flag for the comment and sets comment.is_removed = True.

    I recommend that you give your moderators the comments.can_moderate permission, and remove comments in that way. If you really want your moderators to be able to delete comments, you could do the following:

    1. subclass the CommentsAdmin in admin.py
    2. override the get_actions method
    3. unregister the CommentsAdmin ModelAdmin, then register your subclass.

    To do this, put the following code in one of your apps.

    # myapp.admin.py
    # The app should come after `django.contrib.comments` 
    # in your INSTALLED_APPS tuple
    
    from django.contrib.comments.admin import CommentsAdmin
    
    class MyCommentsAdmin(CommentsAdmin):
        def get_actions(self, request):
            actions = super(MyCommentsAdmin, self).get_actions(request)
            if not request.user.has_perm('comments.can_moderate'):
                if 'approve_comments' in actions:
                    actions.pop('approve_comments')
                if 'remove_comments' in actions:
                    actions.pop('remove_comments')
            return actions
    
    
    admin.site.unregister(CommentsAdmin)
    admin.site.register(MyCommentsAdmin)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently upgraded my Silverlight app from 3 to 4. After a few hours
We recently upgraded a very large project from .NET framework 3.5 to 4, and
We recently upgraded our rails app from version 3.0.3 to 3.1.0. The application runs
Recently upgraded my Android SDK install to r20 and now keyboard input seem to
I recently upgraded to Lion and I am trying to install Rails. I used
We recently upgraded (very successfully) to Tridion 2011 SP1. I want to install Content
I recently 'upgraded' my app to the cedar platform on Heroku. By default, I
I recently upgraded from jQuery 1.2.6 to 1.3.2 Now on the page I'm using
I recently upgraded my machine from Leopard to Snow Leopard. Also I installed the
I recently upgraded my SVN client from 1.6.9 to 1.7.2 and after converting to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.