djangouser.is_authenticated
来源:互联网 发布:java文档怎么看 编辑:程序博客网 时间:2024/06/11 09:41
from django.template import RequestContext
def entry_detail(request, year, month, day, slug):
import datetime, time
date_stamp = time.strptime(year+month+day, "%Y%b%d")
pub_date = datetime.date(*date_stamp[:3])
entry = Entry.objects.get(pub_date__year=pub_date.year, pub_date__month=pub_date.month, pub_date__day=pub_date.day, slug=slug)
return render_to_response('weblog/entry_detail.html', {'entry': entry}, context_instance=RequestContext(request))
{% if user.is_authenticated %}
Welcome, {{ user.username }}. Thanks for logging in.
{% else %}
Welcome, new user. Please log in.
{% endif %}
要傳入RequestContext(request))參數,才可以在template文件裡使用user user.is_authenticated
- djangouser.is_authenticated
- Oracle左连接,右连接
- 从DOORS数据库备份恢复某一个模块
- IntrospectorCleanupListener 简介
- 表驱动
- C++0x 右值引用
- djangouser.is_authenticated
- Linux环境下轻松搭建CVS服务器
- 检查数据库对象是否存在
- Struts1.X 学习笔记1
- Mantis状态流程图及其相关说明
- [Java] 练习题011: 有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
- Microsoft Productivity Hub 2010 安装部署配置(一)
- 双击桌面Internet Explorer图标时创建Internet Explorer快捷方式
- SQL SERVER 表外键查询