diff --git a/cms/tests/test_check.py b/cms/tests/test_check.py index 6f93956b395..cadb4ce60d1 100644 --- a/cms/tests/test_check.py +++ b/cms/tests/test_check.py @@ -61,15 +61,30 @@ def test_no_sekizai(self): with self.settings(INSTALLED_APPS=apps): self.assertCheck(False, errors=1) + def test_no_django_i18n_context_processor(self): + override = {'TEMPLATES': deepcopy(settings.TEMPLATES)} + override['TEMPLATES'][0]['OPTIONS']['context_processors'] = [ + 'sekizai.context_processors.sekizai', + 'cms.context_processors.cms_settings' + ] + with self.settings(**override): + self.assertCheck(False, errors=1) + def test_no_cms_settings_context_processor(self): override = {'TEMPLATES': deepcopy(settings.TEMPLATES)} - override['TEMPLATES'][0]['OPTIONS']['context_processors'] = ['sekizai.context_processors.sekizai'] + override['TEMPLATES'][0]['OPTIONS']['context_processors'] = [ + 'sekizai.context_processors.sekizai', + 'django.template.context_processors.i18n', + ] with self.settings(**override): self.assertCheck(False, errors=1) def test_no_sekizai_template_context_processor(self): override = {'TEMPLATES': deepcopy(settings.TEMPLATES)} - override['TEMPLATES'][0]['OPTIONS']['context_processors'] = ['cms.context_processors.cms_settings'] + override['TEMPLATES'][0]['OPTIONS']['context_processors'] = [ + 'cms.context_processors.cms_settings', + 'django.template.context_processors.i18n', + ] with self.settings(**override): self.assertCheck(False, errors=2) diff --git a/cms/utils/check.py b/cms/utils/check.py index 2aa913bdee1..26bb9840a70 100644 --- a/cms/utils/check.py +++ b/cms/utils/check.py @@ -248,6 +248,7 @@ def check_context_processors(output): chain(*[template['OPTIONS'].get('context_processors', []) for template in settings.TEMPLATES])) required_processors = ( 'cms.context_processors.cms_settings', + 'django.template.context_processors.i18n' ) for processor in required_processors: if processor not in processors: @@ -338,9 +339,9 @@ def get_class(method_name, model): )) if not section.warnings: - section.finish_success('All plugins and page/title extensions have "copy_relations" method if needed.') + section.finish_success('All plugins and page/page content extensions have "copy_relations" method if needed.') else: - section.finish_success('Some plugins or page/title extensions do not define a "copy_relations" method.\n' + section.finish_success('Some plugins or page/page content extensions do not define a "copy_relations" method.\n' 'This might lead to data loss when publishing or copying plugins/extensions.\n' 'See https://django-cms.readthedocs.io/en/latest/extending_cms/custom_plugins.html#handling-relations or ' # noqa 'https://django-cms.readthedocs.io/en/latest/extending_cms/extending_page_title.html#handling-relations.') # noqa @@ -354,7 +355,8 @@ def check(output): Returns whether the configuration/environment are okay (has no errors) """ - title = "Checking django CMS installation" + import cms + title = f"Checking django CMS {cms.__version__} installation" border = '*' * len(title) output.write_line(output.colorize(border, opts=['bold'])) output.write_line(output.colorize(title, opts=['bold']))