I have a CommentResource model in which I want to ensure that a user can delete a comment only authored by him (by sending a DELETE reqeust). So I use follow the answer of this SO question.
def delete_detail(self, object_list, bundle):
return bundle.obj.user == bundle.request.user
But django gives me this error:
delete_detail()got an unexpected keyword argument 'pk'
To ensure that a user can delete a comment only authored by him (by sending a
DELETEreqeust), you need to implement your authorization class like below.