I am working on Django rest framework which specifies a set format for function prototype for detail_route
in ModelViewSet. Some background: -
The function takes in request object
and lookup_field
which can be the primary key for a particular table.
@detail_route(methods=["get"], url_path="get-some-data")
def get_some_data(self, request, id=None):
return Response(get_some_data(id))
Now as you can see, I do not need request object here, So should I keep it like this? or change it to
@detail_route(methods=["get"], url_path="get-some-data")
def get_some_data(self, _, id=None):
return Response(get_some_data(id))
Here I changed request
to _
to indicate that I do not need this value.
which approach should be followed? Should I let it remain as a request, or change it to an underscore?