From 2ded4a5d4090e2136010dc9e31d262e55608b567 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Sat, 15 Jun 2024 10:10:44 +0200 Subject: [PATCH 1/5] feat(django): Upgrade to 5.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a6a58a0c07e..834e60809e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ django-slack==5.19.0 git+https://github.com/DefectDojo/django-tagging@develop#egg=django-tagging django-watson==1.6.3 django-prometheus==2.3.1 -Django==4.2.14 +Django==5.0.7 djangorestframework==3.15.2 html2text==2024.2.26 humanize==4.10.0 From 30a98e22bba26a7c64da6fd41f59d0a030761642 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Sat, 15 Jun 2024 10:12:23 +0200 Subject: [PATCH 2/5] Remove obsolete code --- dojo/settings/settings.dist.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dojo/settings/settings.dist.py b/dojo/settings/settings.dist.py index a02bbba7a8b..63b233405c5 100644 --- a/dojo/settings/settings.dist.py +++ b/dojo/settings/settings.dist.py @@ -1747,12 +1747,3 @@ 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.*") - -# This setting is here to override default renderer of forms (use div-based, instred of table-based). -# It has effect only on templates that use "{{ form }}" in the body. Only "Delete forms" now. -# The setting is here to avoid RemovedInDjango50Warning. It is here only for transition period. -# TODO - Remove this setting in Django 5.0 because DjangoDivFormRenderer will become deprecated and the same class will be used by default DjangoTemplates. -# More info: -# - https://docs.djangoproject.com/en/4.1/ref/forms/renderers/#django.forms.renderers.DjangoTemplates -# - https://docs.djangoproject.com/en/5.0/ref/forms/renderers/#django.forms.renderers.DjangoTemplates -FORM_RENDERER = "django.forms.renderers.DjangoDivFormRenderer" From 0d3a282fb457ab71afb53888aae9079670288914 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 3/5] 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 63b233405c5..a0f456b9edf 100644 --- a/dojo/settings/settings.dist.py +++ b/dojo/settings/settings.dist.py @@ -1747,3 +1747,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/ From d1a1dbd17d07e8d568e0f3f19491dec46072aeba Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:54:33 +0200 Subject: [PATCH 4/5] fix(multiselectfield): Use original repo --- dojo/settings/.settings.dist.py.sha256sum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dojo/settings/.settings.dist.py.sha256sum b/dojo/settings/.settings.dist.py.sha256sum index d02f0c2b041..a98747f8e23 100644 --- a/dojo/settings/.settings.dist.py.sha256sum +++ b/dojo/settings/.settings.dist.py.sha256sum @@ -1 +1 @@ -4483a2efbe3cf1bf1c96c333f9bfc65ffe82a2fb20ed86eb4c4f6726cf41fa94 +81ef49c46f69020055ab669af49da8926b2a5e6d65d6355b98a8f51d53a7713b From 2eb39df97a83371d515e641f8be216bed793ae65 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:16:48 +0200 Subject: [PATCH 5/5] Upgrade to 5.0.8 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 834e60809e4..66b4aa58bd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ django-slack==5.19.0 git+https://github.com/DefectDojo/django-tagging@develop#egg=django-tagging django-watson==1.6.3 django-prometheus==2.3.1 -Django==5.0.7 +Django==5.0.8 djangorestframework==3.15.2 html2text==2024.2.26 humanize==4.10.0