示例#1
0
class GetAuthenticatedUserSerializer(serializers.ModelSerializer):
    profile = GetAuthenticatedUserProfileSerializer(many=False)
    posts_count = PostsCountField()
    unread_notifications_count = UnreadNotificationsCountField()
    followers_count = FollowersCountField()
    is_global_moderator = IsGlobalModeratorField()
    following_count = FollowingCountField()
    is_member_of_communities = IsMemberOfCommunities()
    pending_communities_moderated_objects_count = UserPendingCommunitiesModeratedObjectsCountField(
    )
    active_moderation_penalties_count = UserActiveModerationPenaltiesCountField(
    )
    language = UserLanguageSerializer()

    class Meta:
        model = User
        fields = (
            'id',
            'uuid',
            'email',
            'username',
            'profile',
            'language',
            'posts_count',
            'invite_count',
            'are_guidelines_accepted',
            'followers_count',
            'following_count',
            'connections_circle_id',
            'is_member_of_communities',
            'is_global_moderator',
            'unread_notifications_count',
            'pending_communities_moderated_objects_count',
            'active_moderation_penalties_count',
        )
示例#2
0
class LegacyGetUserUserSerializer(serializers.ModelSerializer):
    profile = GetUserUserProfileSerializer(many=False)
    followers_count = FollowersCountField()
    following_count = FollowingCountField()
    posts_count = UserPostsCountField()
    is_following = IsFollowingField()
    is_followed = IsFollowedField()
    are_new_post_notifications_enabled = AreNewPostNotificationsEnabledForUserField()
    is_connected = IsConnectedField()
    is_fully_connected = IsFullyConnectedField()
    connected_circles = ConnectedCirclesField(circle_serializer=GetUserUserCircleSerializer)
    follow_lists = FollowListsField(list_serializer=GetUserUserListSerializer)
    is_pending_connection_confirmation = IsPendingConnectionConfirmation()
    is_reported = IsUserReportedField()

    class Meta:
        model = User
        fields = (
            'id',
            'username',
            'profile',
            'followers_count',
            'following_count',
            'posts_count',
            'is_following',
            'is_followed',
            'are_new_post_notifications_enabled',
            'is_connected',
            'is_reported',
            'is_fully_connected',
            'connected_circles',
            'follow_lists',
            'date_joined',
            'is_pending_connection_confirmation'
        )
示例#3
0
class GetUserUserSerializer(serializers.ModelSerializer):
    profile = GetUserUserProfileSerializer(many=False)
    followers_count = FollowersCountField()
    following_count = FollowingCountField()
    posts_count = PostsCountField()
    is_following = IsFollowingField()
    is_connected = IsConnectedField()
    is_fully_connected = IsFullyConnectedField()
    connected_circles = ConnectedCirclesField(circle_serializer=GetUserUserCircleSerializer)
    follow_lists = FollowListsField(list_serializer=GetUserUserListSerializer)
    is_pending_connection_confirmation = IsPendingConnectionConfirmation()

    class Meta:
        model = User
        fields = (
            'id',
            'username',
            'profile',
            'followers_count',
            'following_count',
            'posts_count',
            'is_following',
            'is_connected',
            'is_fully_connected',
            'connected_circles',
            'follow_lists',
            'is_pending_connection_confirmation'
        )
示例#4
0
class GetAuthenticatedUserSerializer(serializers.ModelSerializer):
    profile = GetAuthenticatedUserProfileSerializer(many=False)
    posts_count = PostsCountField()
    unread_notifications_count = UnreadNotificationsCountField()
    followers_count = FollowersCountField()
    following_count = FollowingCountField()
    is_member_of_communities = IsMemberOfCommunities()

    class Meta:
        model = User
        fields = ('id', 'uuid', 'email', 'username', 'profile', 'posts_count',
                  'followers_count', 'following_count',
                  'connections_circle_id', 'is_member_of_communities',
                  'unread_notifications_count')