Ejemplo n.º 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'
        )
Ejemplo n.º 2
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',
        )
Ejemplo n.º 3
0
class NotificationPostSerializer(serializers.ModelSerializer):
    image = PostCommentPostImageSerializer()
    video = PostCommentPostVideoSerializer()
    creator = PostCommentCreatorSerializer()
    is_encircled = IsEncircledField()

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'image',
            'text',
            'video',
            'creator',
            'created',
            'is_closed',
            'is_encircled',
        )
Ejemplo n.º 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',
        )
Ejemplo n.º 5
0
class NotificationPostSerializer(serializers.ModelSerializer):
    creator = PostCommentCreatorSerializer()
    is_encircled = IsEncircledField()
    # Temp backwards compat
    image = PostImageSerializer(many=False)

    class Meta:
        model = Post
        fields = (
            'id',
            'uuid',
            'text',
            'creator',
            'created',
            'is_closed',
            'is_encircled',
            'media_height',
            'media_width',
            'media_thumbnail',
            # Temp backwards compat
            'image')
Ejemplo n.º 6
0
class ModeratedObjectPostSerializer(serializers.ModelSerializer):
    creator = CommonPublicUserSerializer()
    community = ModeratedObjectCommunitySerializer()
    image = ModeratedObjectPostImageSerializer()
    language = LanguageSerializer()
    is_encircled = IsEncircledField()

    class Meta:
        model = Post
        fields = (
            'id',
            'text',
            'language',
            'creator',
            'community',
            'image',
            'created',
            'comments_enabled',
            'is_closed',
            'is_encircled',
        )