我想得到现在登录的用户..
这该怎么做 ..
谢谢
这是我的代码:
ps=Position.objects.filter(name=User.username)
Run Code Online (Sandbox Code Playgroud)
更新:
ps=Position.objects.filter(name=request.user.username)
Run Code Online (Sandbox Code Playgroud)
和
return render_to_response(template_name, {
"map_form": map_form,
"map": map,
"group": map, # @@@ this should be the only context var for the map
"is_member": is_member,
"ps":ps
}, context_instance=RequestContext(request))
Run Code Online (Sandbox Code Playgroud)
在HTML中:
var ps='{{ ps.name }}'
alert(ps)
Run Code Online (Sandbox Code Playgroud)
它什么都不打印?
为什么?
| 归档时间: |
|
| 查看次数: |
4315 次 |
| 最近记录: |