I made it in that way, and it works:
def get_fieldsets(self, request, obj=None):
        if obj:
            if request.user.id == 1:
                return self.declared_fieldsets
            else:
                if obj.get_profile().type==1:
                    return (
                        (None, {'fields': ('username', 'password')}),
                        (_('Personal info'), {'fields': ('first_name', 
'last_name', 'email')}),
                        (_('Important dates'), {'fields': ('last_login', 
'date_joined')}),
                    )
                else:
                    return (
                        (None, {'fields': ('username', 'password')}),
                        (_('Personal info'), {'fields': ('first_name', 
'last_name', 'email')}),
                        (_('Permissions'), {'fields': ('is_active', 
'is_staff', 'user_permissions')}),
                        (_('Important dates'), {'fields': ('last_login', 
'date_joined')}),
                    )
        else:
            return self.add_fieldsets

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Mq--t4_P1qMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to