这部分代码代表我网页的索引,例如:127.0.0.1:8000/
def IndexView(request):
try:
profile = request.user.get_profile()
except User.DoesNotExist:
return render_to_response('index.html',
{'request': request,},
context_instance=RequestContext(request))
return render_to_response('index.html',
{'request': request, 'profile' : profile},
context_instance=RequestContext(request))
为什么我在调试时仍然收到此错误?
/ 'AnonymousUser' 对象的 AttributeError 没有属性 'get_profile'
提前致谢