File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,16 @@ Known issues
94
94
95
95
If you reference foreign-key models by their name (as string) ``pylint-django `` may not be
96
96
able to find the model and will report issues because it has no idea what the underlying
97
- type of this field is. If your ``models.py `` itself is not importing the foreign-key class
98
- there's probably some import problem (circular dependencies) preventing referencing the
99
- foreign-key class directly, in which case ``pylint-django `` can't do a huge amount.
100
- If it's just done for convenience that's really up to you the developer to fix.
97
+ type of this field is. Supported options are::
98
+
99
+ - ``self `` and ``Model `` - look for this class in the current module which is being examined
100
+ - ``app.Model `` - try loading ``app.models `` into the AST parser and look for ``Model `` there
101
+
102
+
103
+ If your ``models.py `` itself is not importing the foreign-key class
104
+ there's probably some import problem (likely circular dependencies) preventing referencing
105
+ the foreign-key class directly. In this case ``pylint-django `` can't do much about it.
106
+ We always recommend referencing foreign-key models by their classes.
101
107
102
108
103
109
Contributing
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ def infer_key_classes(node, context=None):
63
63
break
64
64
elif isinstance (arg , nodes .Const ):
65
65
try :
66
- # can be 'self , 'Model' or 'app.Model'
66
+ # can be 'self' , 'Model' or 'app.Model'
67
67
if arg .value == 'self' :
68
68
module_name = ''
69
69
# for relations with `to` first parent be Keyword(arg='to')
You can’t perform that action at this time.
0 commit comments