Exemple #1
0
def _get_user_profile_dict(request, usernames):
    """
    Gets user profile details for a list of usernames and creates a dictionary with
    profile details against username.

    Parameters:

        request: The django request object.
        usernames: A string of comma separated usernames.

    Returns:

        A dict with username as key and user profile details as value.
    """
    request.GET = request.GET.copy()  # Make a mutable copy of the GET parameters.
    request.GET['username'] = usernames
    user_profile_details = AccountViewSet.as_view({'get': 'list'})(request).data

    return {user['username']: user for user in user_profile_details}
Exemple #2
0
def _get_user_profile_dict(request, usernames):
    """
    Gets user profile details for a list of usernames and creates a dictionary with
    profile details against username.

    Parameters:

        request: The django request object.
        usernames: A string of comma separated usernames.

    Returns:

        A dict with username as key and user profile details as value.
    """
    request.GET = request.GET.copy()  # Make a mutable copy of the GET parameters.
    request.GET['username'] = usernames
    user_profile_details = AccountViewSet.as_view({'get': 'list'})(request).data

    return {user['username']: user for user in user_profile_details}