我对django 1.5有一些问题
回溯是
'MyUserAdmin.fieldsets[3][1]['fields']' refers to field 'l' that is missing from the form.
fieldsets = (
(None, {'fields':('name', 'password')}),
('User info', {'fields':('email',)}),
('Permissions',{'fields':('is_admin',)}),
('Important dates',{'fields':('last_login,')}),
)
class MyUser(AbstractBaseUser, PermissionsMixin):
name = models.CharField("姓名", max_length=20, unique=True, db_index=True)
consumption= models.DecimalField("菜品总消费", max_digits=5, decimal_places=0)
email = models.EmailField(max_length=75)
times = models.DecimalField("消费次数", max_digits=4, decimal_places=0)
USERNAME_FIELD = 'name'
REQUIRED_FIELDS = ['email', ]
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
@property
def is_staff(self):
return self.is_admin
def __unicode__(self):
return unicode(self.nam
我无法修复它,我不明白“字段'l'”意味着
答案 0 :(得分:0)
如果这确实是您的字段集声明,则问题是拼写错误 - 您在last_login
的引号内有逗号。它遍历字符串last_login,
,好像它是一个字段名称元组。