阅读背景:

DRF - 为当前用户创建资源别名/我

来源:互联网 

How to make a resource that will have /user/me url endpoint that will point to current user and behave exactly same as /user/< userid > ( e.g all post, put, delete request done to /user/me should work same way as /user/< userid > ). I see that there is a @detail_route decorator for custom routes, but it seems that inside it i will need to duplicate code there , for each separate request method, which doesnt seem to be a good option. I just need to make an alias for current user. Im talking about ModelViewSetHow to make a resource that will have /user/me




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: