Debian Codegraph @

django/core/checks/compatibility/django_4_0.py

raw
1 from django.conf import settings
2
3 from .. import Error, Tags, register
4
5
6 @register(Tags.compatibility)
7 def check_csrf_trusted_origins(app_configs, **kwargs):
8 errors = []
9 for origin in settings.CSRF_TRUSTED_ORIGINS:
10 if "://" not in origin:
11 errors.append(
12 Error(
13 "As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS "
14 "setting must start with a scheme (usually http:// or "
15 "https://) but found %s. See the release notes for details."
16 % origin,
17 id="4_0.E001",
18 )
19 )
20 return errors