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 4646
4747Ensure ``pylint-django `` is installed and on your path and then execute::
4848
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>
5050
5151
5252Prospector
@@ -70,6 +70,9 @@ Features
7070* Validates ``Model.__unicode__ `` methods.
7171* ``Meta `` informational classes on forms and models do not generate errors.
7272* 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!
7376
7477
7578Additional plugins
@@ -92,23 +95,6 @@ This plugin is disabled by default! To enable it::
9295 pylint --load-plugins pylint_django --load-plugins pylint_django.checkers.migrations
9396
9497
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-
11298Contributing
11399------------
114100
You can’t perform that action at this time.
0 commit comments