Skip to content

ForeignKey ignore not work when use self as model #208

@NateScarlet

Description

@NateScarlet
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]

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions