[D]请教一个django login后在模板中显示问题
使用django自带的验证系统auth.login(request, user)登录后,如何在模板中显示该用户信息呢?
查看资料说是需要通过 RequestContext 在模板的context中使用
RequestContext 在这应该如何处理呢
我现在的作法是在一个公有py文件中加入
def custom_proc(request):
return {
'user': request.user
}
然后再view中添加
return render_to_response("showBlogList.html", locals(),context_instance = RequestContext(request, processors = [custom_proc]))
这种方式可行,但比较麻烦,每个view中都需要写入这句话,不知道是不是一个标准的方法
请各位高手指点,谢谢
-------------------------------
Double行动:
原帖分数:20
帖子加分:20