Skip to content

Commit

Permalink
Fix compatibility with pylint-django (#5538)
Browse files Browse the repository at this point in the history
It's not possible to use wagtail in a project with pylint and the
pylint-django plugin.

Pylint-django does not work with foreign keys that are referenced by
their string names. See: https://github.com/PyCQA/pylint-django#known-issues

If we simply replace the string name with the foreign-key class, linting
on wagtail projects is fixed.

Also see:
pylint-dev/pylint#2995
pylint-dev/pylint-django#241
  • Loading branch information
danihodovic authored and gasman committed Sep 3, 2019
1 parent 7fcd6e6 commit af4f27a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS.rst
Expand Up @@ -393,6 +393,7 @@ Contributors
* Mikael Engström
* Zac Connelly
* Sarath Kumar Somana
* Dani Hodovic

Translators
===========
Expand Down
2 changes: 1 addition & 1 deletion wagtail/core/models.py
Expand Up @@ -246,7 +246,7 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
help_text=_("The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/")
)
content_type = models.ForeignKey(
'contenttypes.ContentType',
ContentType,
verbose_name=_('content type'),
related_name='pages',
on_delete=models.SET(get_default_page_content_type)
Expand Down

0 comments on commit af4f27a

Please sign in to comment.