Example #1
0
class GetCommunityCommunitySerializer(serializers.ModelSerializer):
    categories = GetCommunityCommunityCategorySerializer(many=True)
    is_invited = IsInvitedField()
    is_creator = IsCreatorField()
    is_favorite = IsFavoriteField()
    moderators = ModeratorsField(moderator_serializer=GetCommunityStaffUserSerializer)
    administrators = AdministratorsField(administrator_serializer=GetCommunityStaffUserSerializer)
    memberships = CommunityMembershipsField(community_membership_serializer=GetCommunityCommunityMembershipSerializer)
    rules = RulesField()

    class Meta:
        model = Community
        fields = (
            'id',
            'title',
            'name',
            'avatar',
            'cover',
            'members_count',
            'color',
            'description',
            'rules',
            'user_adjective',
            'users_adjective',
            'categories',
            'moderators',
            'administrators',
            'type',
            'invites_enabled',
            'is_invited',
            'is_creator',
            'is_favorite',
            'memberships',
        )
Example #2
0
class MembersCommunitySerializer(serializers.ModelSerializer):
    memberships = CommunityMembershipsField(
        community_membership_serializer=MembersCommunityMembershipSerializer)

    class Meta:
        model = Community
        fields = ('id', 'memberships')
Example #3
0
class SuggestedCommunitiesCommunitySerializer(serializers.ModelSerializer):
    is_creator = IsCreatorField()
    memberships = CommunityMembershipsField(
        community_membership_serializer=CommonCommunityMembershipSerializer)

    class Meta:
        model = Community
        fields = ('id', 'name', 'title', 'avatar', 'cover', 'members_count',
                  'color', 'user_adjective', 'users_adjective', 'is_creator',
                  'memberships')
class CommonSearchCommunitiesCommunitySerializer(serializers.ModelSerializer):
    is_favorite = IsFavoriteField()

    memberships = CommunityMembershipsField(
        community_membership_serializer=CommonCommunityMembershipSerializer)

    class Meta:
        model = Community
        fields = ('id', 'name', 'title', 'avatar', 'cover', 'members_count',
                  'color', 'user_adjective', 'users_adjective', 'is_favorite',
                  'memberships')
Example #5
0
class PostCommunitySerializer(serializers.ModelSerializer):
    memberships = CommunityMembershipsField(community_membership_serializer=CommunityMembershipSerializer)

    class Meta:
        model = Community
        fields = (
            'id',
            'name',
            'avatar',
            'title',
            'cover',
            'color',
            'memberships',
        )
Example #6
0
class CommunitiesCommunitySerializer(serializers.ModelSerializer):
    categories = GetCommunitiesCommunityCategorySerializer(many=True)
    is_invited = IsInvitedField()
    is_favorite = IsFavoriteField()
    is_creator = IsCreatorField()
    memberships = CommunityMembershipsField(
        community_membership_serializer=CommunitiesCommunityMembershipSerializer
    )

    class Meta:
        model = Community
        fields = ('id', 'name', 'title', 'avatar', 'cover', 'members_count',
                  'color', 'user_adjective', 'users_adjective', 'categories',
                  'type', 'is_invited', 'is_favorite', 'is_creator',
                  'invites_enabled', 'memberships')
Example #7
0
class LegacyGetCommunityCommunitySerializer(serializers.ModelSerializer):
    categories = GetCommunityCommunityCategorySerializer(many=True)
    is_invited = IsInvitedField()
    are_new_post_notifications_enabled = AreNewPostNotificationsEnabledForCommunityField(
    )
    is_creator = IsCreatorField()
    is_favorite = IsFavoriteField()
    is_reported = IsCommunityReportedField()
    posts_count = CommunityPostsCountField()
    moderators = ModeratorsField(
        moderator_serializer=GetCommunityStaffUserSerializer)
    administrators = AdministratorsField(
        administrator_serializer=GetCommunityStaffUserSerializer)
    memberships = CommunityMembershipsField(
        community_membership_serializer=
        GetCommunityCommunityMembershipSerializer)
    rules = RulesField()

    class Meta:
        model = Community
        fields = (
            'id',
            'title',
            'name',
            'avatar',
            'cover',
            'members_count',
            'posts_count',
            'color',
            'description',
            'rules',
            'user_adjective',
            'users_adjective',
            'categories',
            'moderators',
            'administrators',
            'type',
            'invites_enabled',
            'is_invited',
            'are_new_post_notifications_enabled',
            'is_creator',
            'is_favorite',
            'is_reported',
            'memberships',
        )
Example #8
0
class CommunitiesCommunitySerializer(serializers.ModelSerializer):
    categories = GetCommunitiesCommunityCategorySerializer(many=True)
    is_invited = IsInvitedField()
    are_new_post_notifications_enabled = AreNewPostNotificationsEnabledForCommunityField(
    )
    is_favorite = IsFavoriteField()
    is_creator = IsCreatorField()
    posts_count = CommunityPostsCountField()
    memberships = CommunityMembershipsField(
        community_membership_serializer=CommonCommunityMembershipSerializer)

    class Meta:
        model = Community
        fields = ('id', 'name', 'title', 'avatar', 'cover', 'members_count',
                  'posts_count', 'color', 'user_adjective', 'users_adjective',
                  'categories', 'type', 'is_invited',
                  'are_new_post_notifications_enabled', 'is_favorite',
                  'is_creator', 'invites_enabled', 'memberships')