mysteriendrama/lib/python3.11/site-packages/django/core/checks/compatibility/django_4_0.py
2023-07-22 12:13:39 +02:00

21 lines
657 B
Python

from django.conf import settings
from .. import Error, Tags, register
@register(Tags.compatibility)
def check_csrf_trusted_origins(app_configs, **kwargs):
errors = []
for origin in settings.CSRF_TRUSTED_ORIGINS:
if "://" not in origin:
errors.append(
Error(
"As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS "
"setting must start with a scheme (usually http:// or "
"https://) but found %s. See the release notes for details."
% origin,
id="4_0.E001",
)
)
return errors