We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
self
from django.db import models class Person(models.Model): parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True) def get_grandparent(self): return self.parent.parent
Got [pylint] Instance of 'ForeignKey' has no 'parent' member [E1101]
[pylint] Instance of 'ForeignKey' has no 'parent' member [E1101]
when change model to 'Person', this warning will disappear
pip freeze:
pip freeze
aniso8601==3.0.2 astroid==2.1.0 atomicwrites==1.2.1 attrs==18.2.0 autopep8==1.4.3 certifi==2018.11.29 cgtwq==3.0.0a5 chardet==3.0.4 colorama==0.4.1 dataclasses==0.6 Django==2.1.3 django-cors-headers==2.4.0 django-environ==0.4.5 django-extensions==2.1.4 django-filter==2.0.0 django-graphql-jwt==0.2.0 graphene==2.1.3 graphene-django==2.2.0 graphene-django-tools==0.12.0 graphql-core==2.1 graphql-relay==0.4.5 idna==2.7 isodate==0.6.0 isort==4.3.4 lazy-object-proxy==1.3.1 mccabe==0.6.1 more-itertools==4.3.0 oauthlib==2.1.0 pluggy==0.8.0 promise==2.2.1 psutil==5.4.7 psycopg2==2.7.6.1 py==1.7.0 pycodestyle==2.4.0 PyJWT==1.6.4 pylint==2.2.2 pylint-django==2.0.4 pylint-plugin-utils==0.4 pypinyin==0.33.2 pytest==4.0.1 pytest-django==3.4.4 pytz==2018.7 Qt.py==1.1.0 requests==2.19.1 rope==0.11.0 Rx==1.6.1 sentry-sdk==0.5.5 singledispatch==3.4.0.3 six==1.11.0 snapshottest==0.5.0 termcolor==1.1.0 urllib3==1.23 websocket-client==0.53.0 wlf==0.5.2 wrapt==1.10.11
The text was updated successfully, but these errors were encountered:
Does self, without the quotes work:
parent = models.ForeignKey(self, on_delete=models.SET_NULL, null=True)
pylint-django is really having troubles with related fields that are referenced as strings, see #142
Sorry, something went wrong.
Does self, without the quotes work: parent = models.ForeignKey(self, on_delete=models.SET_NULL, null=True) pylint-django is really having troubles with related fields that are referenced as strings, see #142
that will be Undefined variable 'self'
Undefined variable 'self'
Fixes pylint-dev#208 Support recursive (self) ForeignKey relations
86ac419
a668707
4547c0a
No branches or pull requests
Got
[pylint] Instance of 'ForeignKey' has no 'parent' member [E1101]
when change model to 'Person', this warning will disappear
pip freeze
:aniso8601==3.0.2
astroid==2.1.0
atomicwrites==1.2.1
attrs==18.2.0
autopep8==1.4.3
certifi==2018.11.29
cgtwq==3.0.0a5
chardet==3.0.4
colorama==0.4.1
dataclasses==0.6
Django==2.1.3
django-cors-headers==2.4.0
django-environ==0.4.5
django-extensions==2.1.4
django-filter==2.0.0
django-graphql-jwt==0.2.0
graphene==2.1.3
graphene-django==2.2.0
graphene-django-tools==0.12.0
graphql-core==2.1
graphql-relay==0.4.5
idna==2.7
isodate==0.6.0
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
more-itertools==4.3.0
oauthlib==2.1.0
pluggy==0.8.0
promise==2.2.1
psutil==5.4.7
psycopg2==2.7.6.1
py==1.7.0
pycodestyle==2.4.0
PyJWT==1.6.4
pylint==2.2.2
pylint-django==2.0.4
pylint-plugin-utils==0.4
pypinyin==0.33.2
pytest==4.0.1
pytest-django==3.4.4
pytz==2018.7
Qt.py==1.1.0
requests==2.19.1
rope==0.11.0
Rx==1.6.1
sentry-sdk==0.5.5
singledispatch==3.4.0.3
six==1.11.0
snapshottest==0.5.0
termcolor==1.1.0
urllib3==1.23
websocket-client==0.53.0
wlf==0.5.2
wrapt==1.10.11
The text was updated successfully, but these errors were encountered: