Mercurial > public > sg101
comparison bio/admin.py @ 790:6a06080e7ca8
Prevent accidental deletion of UserProfiles in the admin.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 23 May 2014 15:39:14 -0500 |
parents | 84865fcd7c26 |
children | eeaf387803c6 |
comparison
equal
deleted
inserted
replaced
789:9e803323a0d0 | 790:6a06080e7ca8 |
---|---|
34 'mark_suspended', | 34 'mark_suspended', |
35 'mark_spammer', | 35 'mark_spammer', |
36 'mark_stranger', | 36 'mark_stranger', |
37 'unsubscribe_forums', | 37 'unsubscribe_forums', |
38 ] | 38 ] |
39 | |
40 def has_delete_permission(self, request, object=None): | |
41 # We don't want to delete a user profile; it is tied to the user object | |
42 return False | |
43 | |
44 def get_actions(self, request): | |
45 # We don't want to delete a user profile; it is tied to the user object | |
46 actions = super(UserProfileAdmin, self).get_actions(request) | |
47 del actions['delete_selected'] | |
48 return actions | |
39 | 49 |
40 def get_status_display(self, obj): | 50 def get_status_display(self, obj): |
41 return obj.get_status_display() | 51 return obj.get_status_display() |
42 get_status_display.short_description = 'Status' | 52 get_status_display.short_description = 'Status' |
43 | 53 |