Skip to content

Commit 17c8b6d

Browse files
committed
Disable no-member in test file
b/c this test file is only to validate we don't get the traceback seen in #232
1 parent e1a5aa9 commit 17c8b6d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
"""
2-
Checks that Pylint does not complain about ForeignKey pointing to model
3-
in module of models package
2+
Checks that Pylint does not crash with ForeignKey string reference pointing to model
3+
in module of models package. See
4+
https://github.com/PyCQA/pylint-django/issues/232
5+
6+
Note: the no-member disable is here b/c pylint-django doesn't know how to
7+
load models.author.Author. When pylint-django tries to load models referenced
8+
by a single string it assumes they are found in the same module it is inspecting.
9+
Hence it can't find the Author class here so it tells us it doesn't have an
10+
'id' attribute. Also see:
11+
https://github.com/PyCQA/pylint-django/issues/232#issuecomment-495242695
412
"""
5-
# pylint: disable=missing-docstring
13+
# pylint: disable=missing-docstring, no-member
614
from django.db import models
715

816

@@ -12,4 +20,4 @@ class FairyTail(models.Model):
1220
author = models.ForeignKey(to='Author', null=True, on_delete=models.CASCADE)
1321

1422
def get_author_name(self):
15-
return self.author.id
23+
return self.author.id # disable via no-member

0 commit comments

Comments
 (0)