Django 源码的学习(一)
2013-11-21 22:58
337 查看
今晚看了下auth/auth,看了下docs,发现红色部分应该是个失误吧,email不是required的,因为
在AbstractUser class中的email = models.EmailField(_('email address'), blank=True)blank=True可以看出
class AbstractUser(AbstractBaseUser, PermissionsMixin):
"""
An abstract base class implementing a fully featured User model with
admin-compliant permissions.
Username, password and email are required. Other fields are optional.
"""
username = models.CharField(_('username'), max_length=30, unique=True,
help_text=_('Required. 30 characters or fewer. Letters, numbers and '
'@/./+/-/_ characters'),
validators=[
validators.RegexValidator(re.compile('^[\w.@+-]+$'), _('Enter a valid username.'), 'invalid')
])
first_name = models.CharField(_('first name'), max_length=30, blank=True)
last_name = models.CharField(_('last name'), max_length=30, blank=True)
email = models.EmailField(_('email address'), blank=True)
is_staff = models.BooleanField(_('staff status'), default=False,
help_text=_('Designates whether the user can log into this admin '
'site.'))
is_active = models.BooleanField(_('active'), default=True,
help_text=_('Designates whether this user should be treated as '
'active. Unselect this instead of deleting accounts.'))
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
objects = UserManager()
class User(AbstractUser):
"""
Users within the Django authentication system are represented by this
model.
Username, password and email are required. Other fields are optional.
"""
class Meta:
swappable = 'AUTH_USER_MODEL'
在AbstractUser class中的email = models.EmailField(_('email address'), blank=True)blank=True可以看出
class AbstractUser(AbstractBaseUser, PermissionsMixin):
"""
An abstract base class implementing a fully featured User model with
admin-compliant permissions.
Username, password and email are required. Other fields are optional.
"""
username = models.CharField(_('username'), max_length=30, unique=True,
help_text=_('Required. 30 characters or fewer. Letters, numbers and '
'@/./+/-/_ characters'),
validators=[
validators.RegexValidator(re.compile('^[\w.@+-]+$'), _('Enter a valid username.'), 'invalid')
])
first_name = models.CharField(_('first name'), max_length=30, blank=True)
last_name = models.CharField(_('last name'), max_length=30, blank=True)
email = models.EmailField(_('email address'), blank=True)
is_staff = models.BooleanField(_('staff status'), default=False,
help_text=_('Designates whether the user can log into this admin '
'site.'))
is_active = models.BooleanField(_('active'), default=True,
help_text=_('Designates whether this user should be treated as '
'active. Unselect this instead of deleting accounts.'))
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
objects = UserManager()
class User(AbstractUser):
"""
Users within the Django authentication system are represented by this
model.
Username, password and email are required. Other fields are optional.
"""
class Meta:
swappable = 'AUTH_USER_MODEL'
相关文章推荐
- Apache Web服务器安全配置全攻略
- Win2003 Server 安全的个人Web服务器
- 简单十大步骤保护IIS Web服务器的安全
- Linux 操作系统下Web服务器配置详细介绍
- Web开发之JavaScript
- CentOS下Lighttpd Web服务器安装与配置方法
- 基于php在各种web服务器的运行模式详解
- 用IIS建立高安全性Web服务器的方法
- IIS做WEB服务器无法下载某些中文名文件的解决方法
- Web开发/设计人员应当知道的15个网站
- Web服务器日志统计分析完全解决方案
- 浅谈Web服务器和应用服务器的区别
- Node.js实战 建立简单的Web服务器
- Nginx防止直接用IP访问Web服务器的设置方法
- 作为Web开发人员,我为什么喜欢Google Chrome浏览器
- 看JQuery如何给力Web开发
- Nginx取消泛解析
- 为高负载网络优化Nginx和Node.js
- Haproxy安装配置及使用