class GetFollowers(ListAPIView):
"""
Returns the users who follw user,along with weather the visiter — the one who sent api request —
follows them or they follow him/her
"""
permission_classes = [IsAuthenticated,]
serializer_class = None
def get_queryset(self,*args,**kwargs):
user = self.request.data.get('user',None)
if user is None:
pass
followers_obj, created = Follow.objects.get_or_create(user=user)
all_followers = followers_obj.followers.all()
现在,当用户在query_params中发送一个请求以及用户名时,如果发送者没有跟踪他/她想要跟踪的人,我如何返回一个错误
您可以提出
ValidationError
相关问题 更多 >
编程相关推荐