增加 @admin_required 修饰符代码和对应的测试

This commit is contained in:
virusdefender
2015-08-06 12:25:16 +08:00
parent 875e3b1671
commit 62f07e713f
4 changed files with 106 additions and 17 deletions

View File

@@ -21,7 +21,8 @@ class User(AbstractBaseUser):
real_name = models.CharField(max_length=30, blank=True, null=True)
# 用户邮箱
email = models.EmailField(max_length=254, blank=True, null=True)
admin_group = models.ForeignKey(AdminGroup, null=True, on_delete=models.SET_NULL)
# 0代表不是管理员 1是普通管理员 2是超级管理员
admin_type = models.IntegerField(default=0)
USERNAME_FIELD = 'username'
REQUIRED_FIELDS = []