From af4f27aa3ec6d704a9a2f71ea81b0a3572502433 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 --- CONTRIBUTORS.rst | 1 + wagtail/core/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 74797d74ff9..fcd3c4cdbd3 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -393,6 +393,7 @@ Contributors * Mikael Engström * Zac Connelly * Sarath Kumar Somana +* Dani Hodovic Translators =========== diff --git a/wagtail/core/models.py b/wagtail/core/models.py index f25ed20e0e4..631a6759dd5 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)