Пример #1
0
class ChatSessionSerializers(serializers.ModelSerializer):
    creator = OwnerSerializer(many=False, read_only=True)
    invited_user = OwnerSerializer(many=False, read_only=True)
    # post = PostSerializers(many=False, read_only=True)

    class Meta:
        model = ChatSession
        fields = ['id', 'uri',  'creator', 'invited_user']
Пример #2
0
class LikeSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)
    post = PostSerializers(many=False, read_only=True)

    class Meta:
        model = Like
        fields = ['user', 'post']
Пример #3
0
class CommentLikeSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)
    comment = CommentSerializers(many=False, read_only=True)

    class Meta:
        model = CommentLike
        fields = ['user', 'comment']
Пример #4
0
class ChatMessageSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)
    chat_session = ChatSessionSerializers(many=False, read_only=True)

    class Meta:
        model = ChatSessionMessage
        fields = ['id', 'user',  'text', 'chat_session',
                  'create_date', 'update_date', 'image', 'received', 'seen']
Пример #5
0
class CommentRepliesSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)

    # post = PostSerializers(many=False, read_only=True)

    class Meta:
        model = CommentReplies
        fields = ['user', 'image', 'text', 'id', 'created_at', 'comment']
Пример #6
0
class PostSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)
    likes = CountLikeSerializers(many=True, read_only=True)
    comments = CommentSerializers(many=True, read_only=True)

    class Meta:
        model = Post
        fields = [
            'comments', 'id', 'content', 'created_at', 'image', 'user', 'likes'
        ]
Пример #7
0
class CommentSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)
    commentReplies = CommentRepliesSerializers(many=True, read_only=True)
    commentlikes = CountCommentLikeSerializers(many=True, read_only=True)

    class Meta:
        model = Comment
        fields = [
            'user', 'image', 'text', 'id', 'created_at', 'commentlikes',
            'commentReplies'
        ]
Пример #8
0
class CountLikeSerializers(serializers.ModelSerializer):
    user = OwnerSerializer(many=False, read_only=True)

    class Meta:
        model = Like
        fields = ['post', 'user']