109👍
✅
The function is getting one argument more than it is supposed to.
Change it to:
def get(self, request, pk):
The value of pk will be equal to the pattern that has been matched, and since you’ve specified that it’s going to be a number, the type of pk will be int.
22👍
add the kwargs into the method definition:
def get(self, request, *args, **kwargs):
return HttpResponse("Created :)")
- [Django]-How to access request body when using Django Rest Framework and avoid getting RawPostDataException
- [Django]-Django download a file
- [Django]-Accessing dictionary by key in Django template
- [Django]-How do I prevent fixtures from conflicting with django post_save signal code?
- [Django]-Django Generic Views using decorator login_required
- [Django]-Import error django corsheaders
Source:stackexchange.com