Python is a dynamic programming language with a dynamic type system (as
opposed to a static type system like for example Java), see
https://en.wikipedia.org/wiki/Dynamic_programming_language

Among other things, that means that type checks are done during runtime.

That means, if Item really does not have an 'objects' member (i.e. Item is
not a Django model), this will only lead to an error if this line of code
is executed, i.e. you visit the URL that points to the index view function.

But if Item is a Django model, this is most likely a false positive of
pylint. The Django ORM makes extensive use of the dynamic nature of Python,
which can confuse pylint. There is a plugin for pylint to make it work more
reliably with Django code: https://pypi.org/project/pylint-django/

Hope that helps,
Daniel


On Tue, Dec 3, 2019 at 1:34 PM Aaryan Dewan <dewanaar...@gmail.com> wrote:

> I was just following this tutorial, on how to make Django apps and how to
> display a database to the user. I created a simple database in models.py
> and then, I defined a function in views.py, which used Item.objects.all().
> Now Pylinter says that* 'Item' has no 'objects' member*!
>
> So this should prevent the server from running ( as its a bug after all!),
> but if I type in *python manage.py runserver,* the terminal shows no
> error and the server starts functioning.
>
> Please see the photo attachment to get a clearer view of the problem!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6428642e-3d7d-4d95-b387-0894c8410897%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6428642e-3d7d-4d95-b387-0894c8410897%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHEnUVV8bMk82rTnWQWFO6O-Yr-gg7d64vUXaAwv_c7KhdBDOQ%40mail.gmail.com.

Reply via email to