Downgrades the error to a warning

This commit is contained in:
Trenton H 2024-10-03 08:55:21 -07:00
parent 63f78658ed
commit bf44571a89
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import textwrap
from django.conf import settings from django.conf import settings
from django.core.checks import Error from django.core.checks import Error
from django.core.checks import Warning
from django.core.checks import register from django.core.checks import register
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
from django.db.utils import OperationalError from django.db.utils import OperationalError
@ -78,7 +79,7 @@ def filename_format_check(app_configs, **kwargs):
converted_format = convert_to_django_template_format(settings.FILENAME_FORMAT) converted_format = convert_to_django_template_format(settings.FILENAME_FORMAT)
if converted_format != settings.FILENAME_FORMAT: if converted_format != settings.FILENAME_FORMAT:
return [ return [
Error( Warning(
f"Filename format {settings.FILENAME_FORMAT} is using the old style, please update to use double curly brackets", f"Filename format {settings.FILENAME_FORMAT} is using the old style, please update to use double curly brackets",
hint=converted_format, hint=converted_format,
), ),

View File

@ -2,6 +2,7 @@ import textwrap
from unittest import mock from unittest import mock
from django.core.checks import Error from django.core.checks import Error
from django.core.checks import Warning
from django.test import TestCase from django.test import TestCase
from django.test import override_settings from django.test import override_settings
@ -82,7 +83,7 @@ class TestDocumentChecks(TestCase):
self.assertEqual( self.assertEqual(
filename_format_check(None), filename_format_check(None),
[ [
Error( Warning(
"Filename format {created}/{title} is using the old style, please update to use double curly brackets", "Filename format {created}/{title} is using the old style, please update to use double curly brackets",
hint="{{ created }}/{{ title }}", hint="{{ created }}/{{ title }}",
), ),