Skip to content

Commit

Permalink
Add warning for discontinued settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 28, 2024
1 parent 5a68e45 commit 526dc9d
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion djangocms_frontend/apps.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
from django import apps
from django.core.checks import Warning, register


class DjangocmsFrontendConfig(apps.AppConfig):
name = "djangocms_frontend"
verbose_name = "DjangoCMS Frontend"
verbose_name = "django CMS Frontend"

def ready(self):
from .component_pool import setup

register(check_settings)
setup()


def check_settings(*args, **kwargs):
from django.conf import settings

warnings = []

if hasattr(settings, "DJANGOCMS_FRONTEND_MINIMUM_INPUT_LENGTH"):
warnings.append(Warning(

Check warning on line 22 in djangocms_frontend/apps.py

View check run for this annotation

Codecov / codecov/patch

djangocms_frontend/apps.py#L22

Added line #L22 was not covered by tests
"The DJANGOCMS_FRONTEND_MINIMUM_INPUT_LENGTH setting was removed in djangocms-frontend 2.\n"
"Use DJANGOCMS_LINK_MINIMUM_INPUT_LENGTH instead.",
"This message disappears after removing the DJANGOCMS_FRONTEND_MINIMUM_INPUT_LENGTH from your project's "
"settings.\n",
id="djangocms_frontend.W001",
obj="settings.DJANGOCMS_FRONTEND_MINIMUM_INPUT_LENGTH",
))
if hasattr(settings, "DJANGOCMS_FRONTEND_LINK_MODELS"):
warnings.append(Warning(

Check warning on line 31 in djangocms_frontend/apps.py

View check run for this annotation

Codecov / codecov/patch

djangocms_frontend/apps.py#L31

Added line #L31 was not covered by tests
"The DJANGOCMS_FRONTEND_LINK_MODELS setting was removed in djangocms-frontend 2.\n"
"djangocms-frontend 2 uses linkable models from djangocms-link. See "
"https://github.com/django-cms/djangocms-link#django-cms-link for more info.",
"This message disappears after removing the DJANGOCMS_FRONTEND_LINK_MODELS from your project's settings.\n",
id="djangocms_frontend.W002",
obj="settings.DJANGOCMS_FRONTEND_LINK_MODELS",
))
return warnings

0 comments on commit 526dc9d

Please sign in to comment.