I am using django-guardian for giving role based permission and django-userena for user profiling. I have three kind of users Admin, sub-admin, employee. Admin can add sub-admin and sub-admin can add employees. I have created three groups in guardian for three user types. When user signup I assign that user an employee group.
class Profile(UserenaBaseProfile):
class Meta:
permissions = (
( "add_admin", "Can add admin" ),
( "add_subadmin", "Can add sub admin" ),
( "add_employee", "Can add employee" ),
)
user = models.OneToOneField(User,
unique=True,
verbose_name='user',
related_name='profile')
first_name = models.CharField('First name',max_length=100,blank=False,null=False)
def save(self, *args, **kwargs):
super(Profile, self).save(*args, **kwargs)
employee_group = Group.objects.get('employee')
self.groups.add(employee_group)
I want to use the Django Admin and give Admin and sub-admin the ability to change the user's group.
How can I add the drop down or radio buttons in the Admin panel using AdminModel so that I can change the user's group. Or is there any better approach to do that.