Reputation: 1619
like this:
the default field in django-rest-framework'route is pk
@detail_route(methods=['GET'])
def run(self, reuqest, pk):
print pk
return xxx
this url's base_url is sched
then I get 0.0.0.0:8000/sched/12/run/
I can get pk=12
in method run
now I want change pk
to id
make me can do like this:
@detail_route(methods=['GET'])
def run(self, reuqest, id):
print id
return xxx
how can i change it?
Upvotes: 1
Views: 291