Hiding fields in the Django admin based on permission

Quick and easy if you have one group of users that can only edit an asset, and another group that has publishing rights

def remove_from_fieldsets(fieldsets, fields):
    for fieldset in fieldsets:
        for field in fields:
            if field in fieldset[1]['fields']:
                new_fields = []
                for new_field in fieldset[1]['fields']:
                    if not new_field in fields:
                fieldset[1]['fields'] = tuple(new_fields)

class PositionAdmin(admin.ModelAdmin):
    def get_fieldsets(self, request, obj=None):
        fieldsets = super(PositionAdmin, self).get_fieldsets(request, obj)
        if not request.user.is_superuser and request.user.groups.filter(name='publisher').count() == 0:
            remove_from_fieldsets(fieldsets, ('is_published',))
        return fieldsets