def get_request_and_username(context):
    """
    Returns request object and username
    """
    request = context['request']
    view = context['view']
    username = view.kwargs.get('username')

    if not username:
        # get the username from the user if not set
        username = (request.user and request.user.username)

    return (request, username)