SystemCheckError: System check identified some issues:

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

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

ERRORS:
<class 'armyapp.admin.DepartAdmin'>: (admin.E019) The value of 'filter_horizontal[0]' refers to 'groups', which is not an attribute of 'armyapp.Depart'.
<class 'armyapp.admin.DepartAdmin'>: (admin.E019) The value of 'filter_horizontal[1]' refers to 'user_permissions', which is not an attribute of 'armyapp.Depart'.
<class 'armyapp.admin.DepartAdmin'>: (admin.E033) The value of 'ordering[0]' refers to 'username', which is not an attribute of 'armyapp.Depart'.
<class 'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[0]' refers to 'is_staff', which does not refer to a Field.
<class 'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[1]' refers to 'is_superuser', which does not refer to a Field.
<class 'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[2]' refers to 'is_active', which does not refer to a Field.
<class 'armyapp.admin.DepartAdmin'>: (admin.E116) The value of 'list_filter[3]' refers to 'groups', which does not refer to a Field.
<class 'armyapp.admin.UserProfileAdmin'>: (admin.E019) The value of 'filter_horizontal[0]' refers to 'permissions', which is not an attribute of 'armyapp.UserProfile'.
<class '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)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值