Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'BlogArticles' has no 'objects' member #4

Open
lzqiang1020 opened this issue Jun 22, 2018 · 3 comments
Open

Class 'BlogArticles' has no 'objects' member #4

lzqiang1020 opened this issue Jun 22, 2018 · 3 comments

Comments

@lzqiang1020
Copy link

文件 ./blog/views.py里,blog_title()函数中 blogs = BlogArticles.objects.all(),提示Class 'BlogArticles' has no 'objects' member",请教下这个怎么解决下?

@qiwsir
Copy link
Owner

qiwsir commented Jun 23, 2018 via email

@lzqiang1020
Copy link
Author

拼写没有问题,同样的语句在交互模式中是可以的,可以生成实例列表
_20180623124758

@wuyoubf
Copy link

wuyoubf commented Mar 30, 2019

pylint在面对django框架时表现的有些不足,因为django使用了大量的元编程(metaprograming)思想以及鸭子模型,以至于在程序运行时会修改不少对象的属性和行为,但是这样给pylint这样的语法检测程序带来了比较大的困难。典型的就是集成了django.db.models.Model的模型层对象在编译时没有objects属性,但是运行时却有,造成我们在编写代码时pylint会报"has no objects attributes"之类的错误,虽然不影响程序运行。
https://www.nuoweb.com/soft/6898.html
pip install pylint-django
在vs code中设置 "python.linting.pylintArgs":["--load-plugins", "pylint_django"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants