Reputation: 4452
Well the title basically says it all. Is it possible to use fields for several groups in the admin.py ? Lets say I got a class with 4 different attributes: 1, 2, 3, 4. And I got 2 different groups: A, B. Now I want that the users of group A can see the fields 1 and 2 of the class and the users of the group B can see the fields 2, 3 and 4 for example.
Upvotes: 0
Views: 37
Reputation: 1659
This case can be solved by referring to the documentation, specifically by using the get_form method
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_form
Test your user's group and exclude the fields accordingly.
Hope this helps,
Regards,
Upvotes: 1