How to I add custom permissions in Django rest framework

Viewed 25

I wanted to ask if can we use model-level permissions from Django in Django rest-framework or do we have to create custom permission differently for Django rest-framework?

 permission = Permission.objects.get(codename = 'is_seller')
 self.request.user.user_permissions.add(permission)

the above code to add permission when a form is submitted is not adding the permission and is showing the error that user_permission does not have an object add()

0 Answers
Related