Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

November 17 2009

Remove named field from fieldsets

This snipped removes a specific field from the fieldsets. This is very useful to leave a field 'out' in the admin, likewise:

def get_fieldsets(self, request, obj=None):
    fieldsets = super(BlaModelAdmin, self).get_fieldsets(request, obj)

    if not request.user.has_perm('change_blah'):
        remove_from_fieldsets(fieldsets, 'blah')