示例#1
0
class NotificationSerializer(serializers.ModelSerializer):
    creator = user_serializers.ListUserSerializer()
    image = image_serializers.SmallImageSerializer()
    
    class Meta:
        model = models.Notification
        fields = '__all__'
示例#2
0
    def post(self, request, image_id, format=None):

        likes = models.Like.objects.filter(image__id=image_id)

        like_creators_ids = likes.values('creator_id')

        users = user_models.User.objects.filter(id__in=like_creators_ids)

        serializer = user_serializers.ListUserSerializer(users, many=True)

        return Response(data=serializer.data, status=status.HTTP_200_OK)