File tree Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Original file line number Diff line number Diff line change 46
46
47
47
Ensure ``pylint-django `` is installed and on your path and then execute::
48
48
49
- pylint --load-plugins pylint_django [..other options..] <path_to_your_sources>
49
+ DJANGO_SETTINGS_MODULE=your.app.settings pylint --load-plugins pylint_django [..other options..] <path_to_your_sources>
50
50
51
51
52
52
Prospector
@@ -70,6 +70,9 @@ Features
70
70
* Validates ``Model.__unicode__ `` methods.
71
71
* ``Meta `` informational classes on forms and models do not generate errors.
72
72
* Flags dangerous use of the exclude attribute in ModelForm.Meta.
73
+ - Uses Django's internal machinery to try and resolve models referenced as
74
+ strings in ForeignKey fields. That relies on ``django.setup() `` which needs
75
+ the appropriate project settings defined!
73
76
74
77
75
78
Additional plugins
@@ -92,23 +95,6 @@ This plugin is disabled by default! To enable it::
92
95
pylint --load-plugins pylint_django --load-plugins pylint_django.checkers.migrations
93
96
94
97
95
- Known issues
96
- ------------
97
-
98
- If you reference foreign-key models by their name (as string) ``pylint-django `` may not be
99
- able to find the model and will report issues because it has no idea what the underlying
100
- type of this field is. Supported options are::
101
-
102
- - ``self `` and ``Model `` - look for this class in the current module which is being examined
103
- - ``app.Model `` - try loading ``app.models `` into the AST parser and look for ``Model `` there
104
-
105
-
106
- If your ``models.py `` itself is not importing the foreign-key class
107
- there's probably some import problem (likely circular dependencies) preventing referencing
108
- the foreign-key class directly. In this case ``pylint-django `` can't do much about it.
109
- We always recommend referencing foreign-key models by their classes.
110
-
111
-
112
98
Contributing
113
99
------------
114
100
You can’t perform that action at this time.
0 commit comments