[英]Django Admin error admin.E008 The value of fieldsets must be a list or tuple
I am getting this error after writing a Custom Admin Model for the custom user I made. 为我创建的自定义用户编写自定义管理模型后,出现此错误。 Here's the code for User Admin : 这是User Admin的代码:
class MyUserAdmin(UserAdmin):
form = UserChangeForm
add_form=UserCreationForm
fieldsets = (
('Personal Details', {
'fields': (
'emp_id',
('emp_first_name', 'emp_last_name'),
('emp_gender', 'emp_dob', 'emp_marital_status'),
('emp_current_add','emp_permanent_add'),
('emp_email_id', 'emp_mobile'),
'emp_interests'
)}),
('Company Details', {
'fields': (
'emp_designation',
'emp_expertise',
('emp_desk_ph', 'emp_pcname', 'emp_current_location'),
('emp_comp_join_date', 'emp_account_join_date'),
('emp_farewell_date', 'emp_company_termination_date', 'emp_account_termination_date', 'emp_relocation_date'),
'is_active'
)}),
('Permission', {
'fields': (
('is_superuser','is_staff','is_admin'),
'groups'
)}),
('Password Details',{'fields' : ('password')}),)
After running makemigrations command , i get this error: 运行makemigrations命令后,出现此错误:
SystemCheckError: System check identified some issues: SystemCheckError:系统检查确定了一些问题:
ERRORS: : (admin.E008) The value of 'fieldsets[1]['fields']' must be a list or tuple. 错误::(admin.E008)'fieldsets [1] ['fields']'的值必须是列表或元组。
Please help me out on this. 请帮助我。 Wasted a lot of time on this one. 在这个上浪费了很多时间。 Thanks in advance 提前致谢
You are missing a trailing comma in your 'Password Details' fieldset. 您在“密码详细信息”字段集中缺少结尾的逗号。 It should be: 它应该是:
('Password Details',{'fields' : ('password',)}),)
Without the comma, ('password')
is the same as 'password'
, which is a string not a tuple. 没有逗号, ('password')
与'password'
相同,后者是字符串而不是元组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.