Skip to content

Commit

Permalink
Fix RemovedInDjango60Warning for FORMS_URLFIELD_ASSUME_HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Jun 17, 2024
1 parent b26dbaa commit 3f4a8d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dojo/settings/.settings.dist.py.sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e9aab91c011f6aa1933791c57e7c37b165e5369606c459f772c4269c56212b53
e8a81b6e6ec235127136294684b140c92cad71138fe4d0fffaa34a2fff8ab2b5
19 changes: 19 additions & 0 deletions dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,3 +1739,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/

0 comments on commit 3f4a8d9

Please sign in to comment.