chore: replace settings.FROM_EMAIL by settings.DEFAULT_FROM_EMAIL

DEFAULT_FROM_EMAIL is a Django standard setting
This commit is contained in:
Yohan Boniface 2024-02-16 11:49:38 +01:00
parent 3f3392952c
commit 1db2455d51
6 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -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`.

View file

@ -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"

View file

@ -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"

View file

@ -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<map_id>[\d]+)/send-edit-link/$",

View file

@ -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,
)