From 06cba91b270af228394d55af2de846bd37aaf41e Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:12:17 +0200 Subject: [PATCH] Fix RemovedInDjango60Warning for FORMS_URLFIELD_ASSUME_HTTPS --- dojo/settings/settings.dist.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dojo/settings/settings.dist.py b/dojo/settings/settings.dist.py index b7e6e13b2a..1b6ca40496 100644 --- a/dojo/settings/settings.dist.py +++ b/dojo/settings/settings.dist.py @@ -1743,3 +1743,22 @@ def saml2_attrib_map_format(dict): # Reference issue: https://github.com/jazzband/django-polymorphic/issues/229 warnings.filterwarnings("ignore", message="polymorphic.base.ManagerInheritanceWarning.*") warnings.filterwarnings("ignore", message="PolymorphicModelBase._default_manager.*") + + +# The setting is here to avoid RemovedInDjango60Warning. It is here only for transition period. +# TODO - Remove this setting in Django 6.0 +# TODO More info: +# Context: +# uwsgi-1 | File "/app/dojo/forms.py", line 515, in ImportScanForm +# uwsgi-1 | source_code_management_uri = forms.URLField(max_length=600, required=False, help_text="Resource link to source code") +# uwsgi-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# uwsgi-1 | File "/usr/local/lib/python3.11/site-packages/django/forms/fields.py", line 769, in __init__ +# uwsgi-1 | warnings.warn( +# uwsgi-1 | django.utils.deprecation.RemovedInDjango60Warning: The default scheme will be changed from 'http' to 'https' in Django 6.0. Pass the forms.URLField.assume_scheme argument to silence this warning, or set the FORMS_URLFIELD_ASSUME_HTTPS transitional setting to True to opt into using 'https' as the new default scheme. +# + +# uwsgi-1 | File "/usr/local/lib/python3.11/site-packages/django/conf/__init__.py", line 214, in __init__ +# uwsgi-1 | warnings.warn( +# uwsgi-1 | django.utils.deprecation.RemovedInDjango60Warning: The FORMS_URLFIELD_ASSUME_HTTPS transitional setting is deprecated. +warnings.filterwarnings("ignore", "The FORMS_URLFIELD_ASSUME_HTTPS transitional setting is deprecated.") +FORMS_URLFIELD_ASSUME_HTTPS = True +# Inspired by https://adamj.eu/tech/2023/12/07/django-fix-urlfield-assume-scheme-warnings/