views:

110

answers:

1

Hi guys, how i'll exclude a field in django admin if the users are not super admin?

thanks

+1  A: 

I did it in this way:

admin.py

def add_view(self, request, form_url='', extra_context=None):  
        if not request.user.is_superuser:     
            self.exclude=('activa', )        
        return super(NoticiaAdmin, self).add_view(request, form_url='', extra_context=None)
Asinox
but i need to repeat with the change_view too :(, somebody have another method?thanks
Asinox
You can't do the same for `change_view`?
rebus
all fine, i did it, just i would like to know if there is another way :)
Asinox