跟着老师配置了用户管理操作后报UserProfile has no field named 'is_staff'的错误
来源:13-3 model_icon, 只读字段,默认排序设置
慕斯2452076
2018-05-06
3回答
-
慕斯2452076
提问者
2018-05-07
这个是adminx的代码
class UserProfileAdmin(UserAdmin):
def get_form_layout(self):
if self.org_obj:
self.form_layout = (
Main(
Fieldset('',
'username', 'password',
css_class='unsort no_title'
),
Fieldset(_('Personal info'),
Row('first_name', 'last_name'),
'email'
),
Fieldset(_('Permissions'),
'groups', 'user_permissions'
),
Fieldset(_('Important dates'),
'last_login', 'date_joined'
),
),
Side(
Fieldset(_('Status'),
'is_active', 'is_staff', 'is_superuser',
),
)
)
return super(UserAdmin, self).get_form_layout()00 -
慕斯2452076
提问者
2018-05-07
class UserProfile(models.Model):
nick_name = models.CharField(max_length=8, verbose_name="昵称", default="")
name = models.CharField(max_length=15 , null=True , blank=True , verbose_name='真实姓名')
birthday = models.DateField(verbose_name="生日", null=True, blank=True)
gender = models.CharField(max_length=1, choices=(("0","男"),("1","女")), default="0")
address = models.CharField(max_length=100, null=True,verbose_name='地址')
mobile = models.CharField(max_length=11, null=True,verbose_name='手机号')
def __str__(self):
return self.nick_name
class Meta:
verbose_name = "用户信息"
verbose_name_plural = verbose_name00 -
bobby
2018-05-07
你截图我看看你的userprofile的设计源码
052018-05-14
相似问题