views:

143

answers:

2

Hi,

I am using django 1.1 beta release. In my project I want to use bulk_action in some models only. How can I disable bulk_action from the remaining models? I want to totally remove action label along with the checkbox; in other words as it would look in Django 1.02.

+1  A: 

Not sure if this is what you're looking for - I can't find any reference to bulk_action online. Bulk actions were introduced in Django 1.1 (see the release notes), so I guess you're referring to removing bulk actions for certain models' admin pages.

If you want no bulk actions available for a given ModelAdmin, simply set ModelAdmin.actions to None:

class MyModelAdmin(admin.ModelAdmin):
    actions = None

from the docs.

I don't think this method will remove the checkboxes, or make the listings page look like Django 1.02, it'll just remove the list of bulk actions from the dropdown.

Dominic Rodger
this does not work
ha22109
in what way? Do you get an error message? Does it not do what it says?
Dominic Rodger
+1  A: 

i used the solution provided in django docs

def get_actions(self, request):
    actions = super(MyModelAdmin, self).get_actions(request)
    if request.user:
        del actions['delete_selected']
    return actions

this removed all the actions from my change page

ha22109