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 Jul 16, 2024
1 parent deae781 commit 18e7e8e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/

0 comments on commit 18e7e8e

Please sign in to comment.