From 9f600ea08c5414454d13ac176471b07e8b65be75 Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Sun, 25 Aug 2019 16:09:34 +0200 Subject: [PATCH] Fix compatibility with pylint-django (#5538) 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 Conflicts: CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 1 + wagtail/core/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 0fce60783b8..c8dd9f6910d 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -383,6 +383,7 @@ Contributors * jonny5532 * William Blackie * Andrew Miller +* Dani Hodovic Translators =========== diff --git a/wagtail/core/models.py b/wagtail/core/models.py index 5499d7c4343..1181c0109fd 100644 --- a/wagtail/core/models.py +++ b/wagtail/core/models.py @@ -243,7 +243,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)