1
I am using vscode together with Djangorestframework and it is error in the following line:
res = User.objects.filter(user_nome=value)
However the code runs correctly, the error that the editor shows is as follows:
pylint E1101:Class 'User' has no 'objects' member User: User
In the stack in English you have the following related questions:
https://stackoverflow.com/questions/115977/using-pylint-with-django/2456436
https://stackoverflow.com/questions/45135263/class-has-no-objects-member
But I was unsuccessful.
I tried to pip install pylint-django
both in the virtual environment and in my machine without success.
I tried to pylint --load-plugins pylint_django
also unsuccessful
I tried to put this in the vscode settings,
{"python.linting.pylintArgs": [
"--load-plugins=pylint_django"
],}
He stopped accusing this error, but began accusing several others, such as asking for a semicolon at the end of a python instruction.
I tried to pylint --ignored-classes= User
He returns to me the following
No config file found, using default configuration
************* Module User
F: 1, 0: No module named User (fatal)
System Version, Fedora Usage Red Hat 8.1.1-1
.
pylint --version
No config file found, using default configuration
pylint 1.9.2,
astroid 1.6.5
Python 2.7.15 (default, May 16 2018, 17:50:09)
The problem continues when I use another class instead of User
If you have it, put dunderscore between the attribute name and the filter. I don’t understand. The User class has the user_name attribute. class User(models.Model): user_name = models.Charfield(max_length=45)
– Joannis