身份认证信息未提供
来源:8-5 用户收藏功能和vue联调
慕姐7020064
2023-09-08
http://localhost:8001/userfavs/
method: post
request data: {goods: “1”}
response:
{
“detail”: “Given token not valid for any token type”,
“code”: “token_not_valid”,
“messages”: [
{
“token_class”: “AccessToken”,
“token_type”: “access”,
“message”: “Token ‘exp’ claim has expired”
}
]
}
code:
class UserFavViewSet(mixins.CreateModelMixin, mixins.DestroyModelMixin, mixins.ListModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet):
'''
list:
获取用户收藏列表
retrieve:
判断某个商品是否已收藏
'''
authentication_classes = (JWTAuthentication, SessionAuthentication,)
permission_classes = (IsAuthenticated, IsOwnerOrReadOnly)
serializer_class = UserFavSerializer
def get_queryset(self):
return UserFav.objects.filter(user=self.request.user)
写回答
1回答
-
慕姐7020064
提问者
2023-09-10
前段需要放开JWT 那段代码,注释Bear
012023-09-13
Python前后端分离开发Vue+Django REST framework实战
Django REST framework课程视频,RESTFul API前后端分离开发
2873 学习 · 2457 问题
相似问题