示例#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 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')