i have an endpoint that takes an id task/:task_id/
. but when i try to access the id in the endpoint i get this error. TypeError: get() got multiple values for argument 'task_id'
i tried to give task_id parameter a none default value.
from huey.contrib.djhuey import HUEY
from rest_framework.views import APIView
class TaskStatus(APIView):
def get(self, task_id):
return Response({
'result': Huey.result(task_id)
})
url(r'tasks/(?P<task_id>[a-f0-9\-]{36})/', TaskStatus.as_view(), name='task-status'),
i expect task_id
to return the id from the url parameter.
The first parameter of get
must be request
itself. change the
def get(self, task_id):
...
to this one:
def get(self, request, task_id):
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With