Exemple #1
0
class AuthenticatedUserPostSerializer(serializers.ModelSerializer):
    image = PostImageSerializer(many=False)
    video = PostVideoSerializer(many=False)
    creator = PostCreatorField(post_creator_serializer=PostCreatorSerializer,
                               community_membership_serializer=CommunityMembershipSerializer)
    reactions_emoji_counts = ReactionsEmojiCountField(emoji_count_serializer=PostEmojiCountSerializer)
    reaction = ReactionField(reaction_serializer=PostReactionSerializer)
    comments_count = CommentsCountField()
    circles = CirclesField(circle_serializer=PostCircleSerializer)
    community = PostCommunitySerializer()
    is_muted = IsMutedField()
    is_encircled = IsEncircledField()

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'comments_count',
            'reactions_emoji_counts',
            'created',
            'text',
            'image',
            'video',
            'creator',
            'reaction',
            'comments_enabled',
            'public_reactions',
            'circles',
            'community',
            'is_muted',
            'is_encircled',
            'is_edited',
            'is_closed'
        )
Exemple #2
0
class CommunityPostSerializer(serializers.ModelSerializer):
    image = CommunityPostImageSerializer(many=False)
    video = CommunityPostVideoSerializer(many=False)
    creator = PostCreatorField(post_creator_serializer=CommunityPostCreatorSerializer,
                               community_membership_serializer=CommunityMembershipSerializer)
    reactions_emoji_counts = PostReactionsEmojiCountField(emoji_count_serializer=CommunityPostEmojiCountSerializer)
    comments_count = CommentsCountField()
    community = CommunityPostCommunitySerializer(many=False)
    is_muted = PostIsMutedField()
    reaction = ReactionField(reaction_serializer=PostReactionSerializer)
    language = PostLanguageSerializer()

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'comments_count',
            'comments_enabled',
            'reactions_emoji_counts',
            'created',
            'text',
            'image',
            'video',
            'language',
            'creator',
            'community',
            'is_muted',
            'reaction',
            'is_edited',
            'is_closed'
        )
Exemple #3
0
class AuthenticatedUserPostSerializer(serializers.ModelSerializer):
    creator = PostCreatorField(
        post_creator_serializer=PostCreatorSerializer,
        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()
    post_links = PostLinkSerializer(many=True)

    # Temp backwards compat
    image = PostImageSerializer(many=False)

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'comments_count',
            'reactions_emoji_counts',
            'post_links',
            'created',
            'text',
            'creator',
            'reaction',
            'comments_enabled',
            'public_reactions',
            'circles',
            'community',
            'language',
            'is_muted',
            'is_encircled',
            'is_edited',
            'is_closed',
            'media_height',
            'media_width',
            'media_thumbnail',
            # Temp backwards compat
            'image',
        )
Exemple #4
0
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',
        )
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')