Reputation: 123
I have trouble in getting the params pk in my url, resources/<int:pk>
in the my django rest framework permission.
def has_permission(self, request, view):
#extract params pk here
pass
I tried request.POST.get('pk')
but it returns nothing.
Upvotes: 1
Views: 783
Reputation: 32294
You can access the URL parameters via view.kwargs
def has_permission(self, request, view):
pk = view.kwargs.get('pk')
...
Upvotes: 8