Django框架使用时候报type object 'BookInfo' has no attribute 'objects'

Django框架使用时候报type object 'BookInfo' has no attribute 'objects'

具体原因如下

在django框架中模型models里面使用自定义管理,从而导致默认objects被替代了,所以会报错,还有一种就是写错了大家都知道

models

Django框架使用时候报type object 'BookInfo' has no attribute 'objects'

解决该错误的方法:
1.把books = BookInfoManager()注释掉
2.或者将objects改为books
Django框架使用时候报type object 'BookInfo' has no attribute 'objects'