我有以下看法:
@login_required
def manage(request):
''' Display the list of posts that belong to the user '''
posts = Post.objects.filter(user=request.user).order_by('created_at')
return render_to_response('posts/manage.html', {'posts':posts}, context_instance=RequestContext(request))
我的模板中的request
变量为空。
我的设置:
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
'social_auth.context_processors.social_auth_by_name_backends',
)
我想通过request.user
.
有什么问题?谢谢。
请注意,我使用社交身份验证进行用户登录。