From dcd62f6ccee1278860e450fbe6cae26c86850a3f Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Sun, 25 Aug 2019 16:09:34 +0200 Subject: [PATCH] Fix compatability with pylint-django 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: https://github.com/PyCQA/pylint/issues/2995 https://github.com/PyCQA/pylint-django/issues/241 --- wagtail/core/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagtail/core/models.py b/wagtail/core/models.py index f25ed20e0e48..631a6759dd55 100644 --- a/wagtail/core/models.py +++ b/wagtail/core/models.py @@ -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)