3

In django, I can use django-guardian for object level permission for user and groups. But what if I want to set field level permission?

Lets say I have a model as below:

class Attribute(models.Model):
    name = models.CharField()
    reg = models.CharField()
    location = models.CharField()

and I have three users in my system and these are user1, user2, and user3

Now I want user1 will get a permission for all three fields of model Attribute. But user2 will get permission to only name and geg and user3 will get permission for only the name field.

In my system there are a lot of users and groups. Is there any way like django-guardian to set field level permissions in django.

cjahangir
  • 1,773
  • 18
  • 27
  • Are you using django-rest-framework? If so then there is a tweak for this – Ab1gor Mar 04 '19 at 11:15
  • Does this answer your question? [Field Level Permission Django](https://stackoverflow.com/questions/20398362/field-level-permission-django) – benzkji Nov 15 '21 at 15:38
  • duplicate as far as a "working solution for the problem" is the solution. I dont know of a reusable app for this problem, as is django-guardian for object level permissions...though. – benzkji Nov 15 '21 at 15:40

0 Answers0