Пример #1
0
class BoardLikeSerializer(serializers.ModelSerializer):

    owner = UserSerializer()

    class Meta:
        model = models.BoardLike
        fields = '__all__'
Пример #2
0
class CommentLikeSerializer(serializers.ModelSerializer):

    owner = UserSerializer(read_only=True)

    class Meta:
        model = models.CommentLike
        fields = '__all__'
Пример #3
0
class PresentSerializer(serializers.ModelSerializer):

    owner = UserSerializer()

    class Meta:
        model = models.Present
        fields = '__all__'
Пример #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',
        )
Пример #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',
        )