Skip to content

Commit

Permalink
Merge b4f07fc into d03555b
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Jul 22, 2020
2 parents d03555b + b4f07fc commit a9ea966
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.rst
@@ -1,6 +1,17 @@
Changelog
=========

Version 2.2.0 (22 Jul 2020)
---------------------------

- Rely on Django to resolve string references in ForeignKey fields. Refs
`#243 <https://github.com/PyCQA/pylint-django/issues/243>`_ (Alejandro Angulo)
- Suppress ``unused-argument`` for functions in migration modules. Fix
`#267 <https://github.com/PyCQA/pylint-django/issues/267>`_
- New checker for hard-coded ``auth.User``. Fix
`#244 <https://github.com/PyCQA/pylint-django/issues/244>`_


Version 2.1.0 (12 Jul 2020)
---------------------------

Expand Down
22 changes: 4 additions & 18 deletions README.rst
Expand Up @@ -46,7 +46,7 @@ Usage

Ensure ``pylint-django`` is installed and on your path and then execute::

pylint --load-plugins pylint_django [..other options..] <path_to_your_sources>
DJANGO_SETTINGS_MODULE=your.app.settings pylint --load-plugins pylint_django [..other options..] <path_to_your_sources>


Prospector
Expand All @@ -70,6 +70,9 @@ Features
* Validates ``Model.__unicode__`` methods.
* ``Meta`` informational classes on forms and models do not generate errors.
* Flags dangerous use of the exclude attribute in ModelForm.Meta.
* Uses Django's internal machinery to try and resolve models referenced as
strings in ForeignKey fields. That relies on ``django.setup()`` which needs
the appropriate project settings defined!


Additional plugins
Expand All @@ -92,23 +95,6 @@ This plugin is disabled by default! To enable it::
pylint --load-plugins pylint_django --load-plugins pylint_django.checkers.migrations


Known issues
------------

If you reference foreign-key models by their name (as string) ``pylint-django`` may not be
able to find the model and will report issues because it has no idea what the underlying
type of this field is. Supported options are::

- ``self`` and ``Model`` - look for this class in the current module which is being examined
- ``app.Model`` - try loading ``app.models`` into the AST parser and look for ``Model`` there


If your ``models.py`` itself is not importing the foreign-key class
there's probably some import problem (likely circular dependencies) preventing referencing
the foreign-key class directly. In this case ``pylint-django`` can't do much about it.
We always recommend referencing foreign-key models by their classes.


Contributing
------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -13,7 +13,7 @@
author_email='code@landscape.io',
description='A Pylint plugin to help Pylint understand the Django web framework',
long_description=LONG_DESCRIPTION,
version='2.1.0',
version='2.2.0',
packages=find_packages(),
include_package_data=True,
install_requires=[
Expand Down

0 comments on commit a9ea966

Please sign in to comment.