(admin.E108) The value of 'list_display[0]' refers to ' studentId', which is not a callable, an attribute of 'StudentsAdmin', or an attribute or method on 'students.Students'. <class 'students.admin.StudentsAdmin'>: (admin.E108) The value of 'list_display[5]' refers to ' zhuanye', which is not a callable, an attribute of 'StudentsAdmin', or an attribute or method on 'students.Students'.

models,和admin下的注册问题

在models定义的属性,在admin的list_display中显示出来,报的错误


提示错误

实际是自己的list_display格式错误,检查发现

class StudentsAdmin(admin.ModelAdmin):

list_display = [' studentId', 'studentName', 'password', 'gender',  'institute', ' zhuanye']

是第一个和最后一个在复制的时候多加了一个空格。

!!!删掉空格即可。python的格式真的很严格

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容