Hi Folks, I have one Follower system and here I want to check those are following to me, we have a mutual connection or not. If they are following to me and I'm not following to them, I want to set in frontend follow back. Inside the views I'm fetching the data and sending them to serializer but I don't ,How I can check it? My models and views are in below:
models.py ----------------- *class Follow(models.Model): follower = models.ForeignKey(User,on_delete = models.CASCADE,related_name = 'following') followee = models.ForeignKey(User,on_delete = models.CASCADE,related_name = 'followers') created_at = models.DateTimeField(auto_now_add = True, null = True) updated_at = models.DateTimeField(auto_now = True, null = True) class Meta: unique_together = ("follower", "followee") ordering = ('-created_at',)* views.py: ------------------- *class FollowerAPIView(APIView,PaginationHandlerMixin): pagination_class = BasicPagination serializer_class = UserFollowerSerializer def get(self,request,*args,**kwargs): follower_qs = Follow.objects.filter(followee = request.user).select_related('follower') page = self.paginate_queryset(follower_qs) if page is not None: serializer = self.get_paginated_response(self.serializer_class(page, many=True).data) else: serializer = self.serializer_class(follower_qs, many=True) return Response(serializer.data,status=status.HTTP_200_OK)* Please help me Thank You Regards, Soumen -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WaE33pNOug_XSrX4guKFFCpnRtv3kdq2FYh8OHhf2CYrQ%40mail.gmail.com.