コード例 #1
0
ファイル: serializers.py プロジェクト: wbolster/okuna-api
class UnauthenticatedUserPostSerializer(serializers.ModelSerializer):
    creator = PostCreatorField(
        post_creator_serializer=CommonPublicUserSerializer,
        community_membership_serializer=CommunityMembershipSerializer)
    reactions_emoji_counts = PostReactionsEmojiCountField(
        emoji_count_serializer=PostEmojiCountSerializer)
    comments_count = CommentsCountField()
    language = PostLanguageSerializer()
    hashtags = CommonHashtagSerializer(many=True)
    links = CommonPostLinkSerializer(many=True)

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'comments_count',
            'reactions_emoji_counts',
            'created',
            'text',
            'creator',
            'language',
            'comments_enabled',
            'public_reactions',
            'is_edited',
            'media_height',
            'media_width',
            'media_thumbnail',
            'hashtags',
            'links',
        )
コード例 #2
0
ファイル: serializers.py プロジェクト: zoist/okuna-api
class AuthenticatedUserEditPostSerializer(serializers.ModelSerializer):
    language = PostLanguageSerializer()
    hashtags = CommonHashtagSerializer(many=True)

    class Meta:
        model = Post
        fields = ('id', 'uuid', 'text', 'language', 'is_edited', 'hashtags')
コード例 #3
0
class NotificationPostCommentSerializer(serializers.ModelSerializer):
    commenter = PostCommentCommenterSerializer()
    post = NotificationPostSerializer()
    parent_comment = NotificationPostCommentParentSerializer()
    is_muted = PostCommentIsMutedField()
    language = PostCommentLanguageSerializer()
    hashtags = CommonHashtagSerializer(many=True)

    class Meta:
        model = PostComment
        fields = ('id', 'commenter', 'language', 'text', 'post', 'created',
                  'parent_comment', 'is_muted', 'hashtags')
コード例 #4
0
ファイル: serializers.py プロジェクト: zoist/okuna-api
class PostCommentReplySerializer(serializers.ModelSerializer):
    parent_comment = PostCommentRepliesParentCommentSerializer()
    commenter = PostCommenterField(
        post_commenter_serializer=PostCommentCommenterSerializer,
        community_membership_serializer=
        PostCommenterCommunityMembershipSerializer)
    reactions_emoji_counts = PostCommentReactionsEmojiCountField(
        emoji_count_serializer=PostCommentReactionEmojiCountSerializer)
    reaction = PostCommentReactionField(
        post_comment_reaction_serializer=PostCommentReactionSerializer)
    is_muted = PostCommentIsMutedField()
    language = PostCommentLanguageSerializer()
    hashtags = CommonHashtagSerializer(many=True)

    class Meta:
        model = PostComment
        fields = ('commenter', 'parent_comment', 'text', 'language', 'created',
                  'is_edited', 'is_muted', 'reactions_emoji_counts', 'id',
                  'reaction', 'hashtags')
コード例 #5
0
ファイル: serializers.py プロジェクト: wbolster/okuna-api
class GetPostPostSerializer(serializers.ModelSerializer):
    creator = PostCreatorField(
        post_creator_serializer=CommonPublicUserSerializer,
        community_membership_serializer=CommunityMembershipSerializer)
    reactions_emoji_counts = PostReactionsEmojiCountField(
        emoji_count_serializer=PostEmojiCountSerializer)
    reaction = ReactionField(reaction_serializer=PostReactionSerializer)
    comments_count = CommentsCountField()
    circles = CirclesField(circle_serializer=PostCircleSerializer)
    community = PostCommunitySerializer()
    is_muted = PostIsMutedField()
    language = PostLanguageSerializer()
    is_encircled = IsEncircledField()
    hashtags = CommonHashtagSerializer(many=True)
    links = CommonPostLinkSerializer(many=True)

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'comments_count',
            'reactions_emoji_counts',
            'created',
            'text',
            'creator',
            'reaction',
            'language',
            'comments_enabled',
            'public_reactions',
            'circles',
            'community',
            'hashtags',
            'links',
            'is_muted',
            'is_edited',
            'is_closed',
            'is_encircled',
            'media_height',
            'media_width',
            'media_thumbnail',
        )
コード例 #6
0
class CommunityPostSerializer(serializers.ModelSerializer):
    # Temp backwards compat
    image = CommonPostImageSerializer(many=False)
    creator = PostCreatorField(
        post_creator_serializer=CommonPostCreatorSerializer,
        community_membership_serializer=CommonCommunityMembershipSerializer)
    reactions_emoji_counts = PostReactionsEmojiCountField(
        emoji_count_serializer=CommonPostEmojiCountSerializer)
    comments_count = CommentsCountField()
    community = CommonPostCommunitySerializer(many=False)
    is_muted = PostIsMutedField()
    reaction = ReactionField(reaction_serializer=CommonPostReactionSerializer)
    language = CommonPostLanguageSerializer()
    hashtags = CommonHashtagSerializer(many=True)

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'comments_count',
            'comments_enabled',
            'reactions_emoji_counts',
            'created',
            'text',
            # Temp backwards compat
            'image',
            'language',
            'creator',
            'community',
            'is_muted',
            'reaction',
            'is_edited',
            'is_closed',
            'media_height',
            'media_width',
            'media_thumbnail',
            'hashtags')