Neo10373's recent timeline updates
Neo10373

Neo10373

V2EX member #393477, joined on 2019-03-19 16:45:31 +08:00
Neo10373's recent replies
create,retrieve 等默认 action 是不行的, 会自动使用 UserViewSet 的 authentication_classes,

1. 要么关闭视图类属性的 authentication_classes, 每个 action 内自己使用 JwtAuthorizationAuthentication 进行认证
2. 要么去掉 CreateModelMixin, RetrieveModelMixin, 自己写 action
```
@action(detail=False, authentication_classes=(JwtAuthorizationAuthentication, ))
def my_create(self, request, *args, **kwargs):

@action(detail=True, authentication_classes=())
def my_retrieve(self, request, *args, **kwargs):
```
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3208 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 12:37 · PVG 20:37 · LAX 05:37 · JFK 08:37
♥ Do have faith in what you're doing.