def view_inside_a_view(request):
    return HttpResponse('hello %s' % request.user)

def view(request):
    user = User.objects.get(id=2)
backend = get_backends()[0]
user.backend = '%s.%s' % (backend.__module__, backend.__class__.__name__)
login(request, user)
request.user = user
response = view_inside_a_view(request)
return HttpResponse('rendered view: %s' % response.content)
Creating a fake request to render a view to a string in django