Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Column/field level permissions in Django admin site?

Is it possible to implement column level permissions per user in the Django admin site?

Its a small project and I only need two groups of permissions.

In the docs I cant find anything out of the box however I was wondering if its possible to create two admin sites and use separate ModelAdmin.exclude or ModelAdmin.fields for each one? I know it's probably a stretch though.

I tried looking around too but I only found row level permissions (django-granular-permissions).

I know it can be done quite easily in my own views by storing the permissions but I was wondering if there was a way to use the admin site or if there is another app out there.

like image 627
ccnet Avatar asked Nov 14 '22 14:11

ccnet


1 Answers

One way is to create admin sites and use separate ModelAdmin.exclude or ModelAdmin.fields for each one.

Rather than mess with this too much, we create our own view functions. They're not complex.

We use separate Forms for each class of user. The view functions are almost the same, except the permissions required.

like image 182
S.Lott Avatar answered Nov 24 '22 11:11

S.Lott