SystemCheckError: System check identified some issues:

今天在django迁移文件时,总报错误
运行的时候也报错。

python manage.py makemigrations
SystemCheckError: System check identified some issues:

ERRORS:
'armyapp.admin.DepartAdmin'>: (admin.E019) The value of 'filter_horizontal[0]' refers to 'groups', which is not an attribute of 'armyapp.Depart'.
'armyapp.admin.DepartAdmin'>: (admin.E019) The value of 'filter_horizontal[1]' refers to 'user_permissions', which is not an attribute of 'armyapp.Depart'.
'armyapp.admin.DepartAdmin'>: (admin.E033) The value of 'ordering[0]' refers to 'username', which is not an attribute of 'armyapp.Depart'.
'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[0]' refers to 'is_staff', which does not refer to a Field.
'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[1]' refers to 'is_superuser', which does not refer to a Field.
'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[2]' refers to 'is_active', which does not refer to a Field.
'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[3]' refers to 'groups', which does not refer to a Field.
'armyapp.admin.UserProfileAdmin'>: (admin.E019) The value of 'filter_horizontal[0]' refers to 'permissions', which is not an attribute of 'armyapp.UserProfile'.
'armyapp.admin.UserProfileAdmin'>: (admin.E033) The value of 'ordering[0]' refers to 'name', which is not an attribute of 'armyapp.UserProfile'.

结果很尴尬
是因为我在注册模型类和对应的admin时写反了。。。。。。

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from .models import UserProfile, Depart


class DepartAdmin(GroupAdmin):
    list_display = ['dcode']


class UserProfileAdmin(UserAdmin):
    # 定义admin总览里每行的显示信息
    list_display = ('cname', 'username', 'email')
    # 定义搜索框以哪些字段可以搜索
    search_fields = ('cname', 'username')
admin.site.register(Depart, UserProfileAdmin)
admin.site.register(UserProfile, DepartAdmin)

你可能感兴趣的:(django)