4

In admin.py file i paste:

admin.site.disable_action('delete_selected')

And get an error:

KeyError at /

'delete_selected'

Django Version: 1.3 Exception Type: KeyError Exception Value:

'delete_selected'

Exception Location: c:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\contrib\admin\sites.py in disable_action, line 127

Any idea why it occurs? In my previous websites I haven't that error and it is strange for me.

robos85
  • 2,484
  • 5
  • 32
  • 36
  • 3
    are you doing it twice, or is the code being imported twice? the admin code just does this: del self._actions[name] so if the second time around it already deleted it, you'd receive a key error – Aaron Aug 02 '11 at 18:14

2 Answers2

2

delete the admin.pyc file in your apps directory

gadss
  • 21,687
  • 41
  • 104
  • 154
2

This got rid of the issue for me. Just a quick test for 'delete_selected' before disabling the action.

if 'delete_selected' in admin.site.actions:
    admin.site.disable_action('delete_selected')

Cheers

stroz
  • 1,890
  • 1
  • 16
  • 28