I am trying to implement an object-level permission. When I run my code, I get an error message saying that I am using too many positional arguments.
TypeError: has_object_permission() takes 3 positional arguments but 4 were given
However, when I check the documentation for the Django Rest framework, four arguments are also used.
class PostOwnerPermssion(permissions.BasePermission):
"""
Check if authenticated user is story author
"""
def has_object_permission(self,request,obj,**kwargs):
if request.user.id == story.author:
return True
return False
Im happy for any clarification.
Thank you.