Ejemplo n.º 1
0
class BoardLikeSerializer(serializers.ModelSerializer):

    owner = UserSerializer()

    class Meta:
        model = models.BoardLike
        fields = '__all__'
Ejemplo n.º 2
0
class CommentLikeSerializer(serializers.ModelSerializer):

    owner = UserSerializer(read_only=True)

    class Meta:
        model = models.CommentLike
        fields = '__all__'
Ejemplo n.º 3
0
class PresentSerializer(serializers.ModelSerializer):

    owner = UserSerializer()

    class Meta:
        model = models.Present
        fields = '__all__'
Ejemplo n.º 4
0
class CommentSerializer(serializers.ModelSerializer):

    comment_likes = CommentLikeSerializer(many=True)
    owner = UserSerializer()

    class Meta:
        model = models.Comment
        fields = (
            'id',
            'owner',
            'content',
            'sound',
            'comment_likes',
        )
Ejemplo n.º 5
0
class BoardSerializer(serializers.ModelSerializer):

    owner = UserSerializer()
    present = PresentSerializer()
    comments = CommentSerializer(many=True)
    board_likes = BoardLikeSerializer(many=True)

    class Meta:
        model = models.Board
        fields = (
            'id',
            'owner',
            'present',
            'title',
            'content',
            'due_date',
            'comments',
            'board_likes',
        )