Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.10/site-packages/django/core/checks/compatibility/django_4_0.py: 44%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

9 statements  

1from django.conf import settings 

2 

3from .. import Error, Tags, register 

4 

5 

6@register(Tags.compatibility) 

7def 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