From 1db2455d51720f5dc2e118b683a896bf1a5d979a Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 16 Feb 2024 11:49:38 +0100 Subject: [PATCH] chore: replace settings.FROM_EMAIL by settings.DEFAULT_FROM_EMAIL DEFAULT_FROM_EMAIL is a Django standard setting --- docs/changelog.md | 1 + docs/config/settings.md | 4 ++-- umap/settings/base.py | 2 +- umap/tests/settings.py | 2 +- umap/urls.py | 2 +- umap/views.py | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 8732f0f4..e0a80d90 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -19,6 +19,7 @@ More details below! * remove `django-compressor`, so `umap compress` is not a valid command anymore (compress is now done in the `collectstatic` process itself) (#1544, #1539) * remove support for settings starting with `LEAFLET_STORAGE_` (deprecated since 1.0.0) * remove support for deprecated OpenStreetMap OAuth1 backend in favour of OAuth2 +* `FROM_EMAIL` setting is replaced by `DEFAULT_FROM_EMAIL`, which is [Django standard](https://docs.djangoproject.com/en/5.0/ref/settings/#default-from-email) #### Migrate to OpenStreetMap OAuth2 diff --git a/docs/config/settings.md b/docs/config/settings.md index 2f2650ed..bebf0f7d 100644 --- a/docs/config/settings.md +++ b/docs/config/settings.md @@ -39,7 +39,7 @@ documentation. In general, you'll need to add something like this in your local settings: ```python title="local_settings.py" -FROM_EMAIL = "youradmin@email.org" +DEFAULT_FROM_EMAIL = "youradmin@email.org" EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = "smtp.provider.org" EMAIL_PORT = 456 @@ -60,7 +60,7 @@ Can be set through env var: `ENABLE_ACCOUNT_LOGIN=1` User accounts can be managed via the Django admin page (`{SITE_URL}/admin`). The required superuser must be created on the command line with this command: `umap createsuperuser`. -#### FROM_EMAIL +#### DEFAULT_FROM_EMAIL See `EMAIL_BACKEND`. diff --git a/umap/settings/base.py b/umap/settings/base.py index b564a5ac..d3265c3d 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -128,7 +128,7 @@ INSTALLED_APPS = ( DEFAULT_AUTO_FIELD = "django.db.models.AutoField" EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" -FROM_EMAIL = None +DEFAULT_FROM_EMAIL = None # https://docs.djangoproject.com/en/4.2/releases/4.1/#forms FORM_RENDERER = "django.forms.renderers.DjangoDivFormRenderer" diff --git a/umap/tests/settings.py b/umap/tests/settings.py index c79521f0..bdc4d546 100644 --- a/umap/tests/settings.py +++ b/umap/tests/settings.py @@ -3,7 +3,7 @@ import os from umap.settings.base import * # pylint: disable=W0614,W0401 SECRET_KEY = "justfortests" -FROM_EMAIL = "test@test.org" +DEFAULT_FROM_EMAIL = "test@test.org" EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" STORAGES["staticfiles"][ "BACKEND" diff --git a/umap/urls.py b/umap/urls.py index 11f752f3..72fff437 100644 --- a/umap/urls.py +++ b/umap/urls.py @@ -156,7 +156,7 @@ map_urls = [ name="datalayer_permissions", ), ] -if settings.FROM_EMAIL: +if settings.DEFAULT_FROM_EMAIL: map_urls.append( re_path( r"^map/(?P[\d]+)/send-edit-link/$", diff --git a/umap/views.py b/umap/views.py index c3bbc867..5c90fe97 100644 --- a/umap/views.py +++ b/umap/views.py @@ -842,7 +842,7 @@ class SendEditLink(FormLessEditMixin, FormView): % {"map_name": self.object.name} ), _("Here is your secret edit link: %(link)s" % {"link": link}), - settings.FROM_EMAIL, + settings.DEFAULT_FROM_EMAIL, [email], fail_silently=False, )