# Simplifying ADMINS and MANAGERS settings?

**URL:** <https://forum.djangoproject.com/t/simplifying-admins-and-managers-settings/38286>\
**Category:** Django Internals\
**Created:** [January 27, 2025, 8:55pm UTC](https://forum.djangoproject.com/t/simplifying-admins-and-managers-settings/38286 "2025-01-27T20:55:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![medmunds](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/medmunds/32/22140_2.png) [@medmunds](https://forum.djangoproject.com/u/medmunds)\
**Post date:** [January 27, 2025, 8:55pm UTC](https://forum.djangoproject.com/t/simplifying-admins-and-managers-settings/38286/1 "2025-01-27T20:55:37Z")

</div>

I’d like to change the ADMINS and MANAGERS settings to take lists of plain email addresses, rather than tuples of (name, email). I opened ticket [#36138](https://code.djangoproject.com/ticket/36138), where @sarahboyce requested forum feedback first.

#### Background

The [ADMINS](https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-ADMINS) and [MANAGERS](https://docs.djangoproject.com/en/5.1/ref/settings/#managers) settings are documented to take lists of (Full name, email address) tuples:

```python
ADMINS = [("John", "john@example.com"), ("Mary", "mary@example.com")]

```

While investigating some other mail-related code, I noticed they don’t actually work as documented—and maybe never have.  
The name part **is discarded** [in mail\_admins()](https://github.com/django/django/blob/main/django/core/mail/ __init__.py#L134) and [mail\_managers()](https://github.com/django/django/blob/330d89d4fe7832355535580383523f1749a3ee45/django/core/mail/ __init__.py#L154). (And it’s [been like that](https://github.com/django/django/blob/ed114e15106192b22ebb78ef5bf5bce72b419d13/django/core/mail.py#L43-L51) at least as long as Django has been public.)

Users might reasonably expect these settings would take lists of email address strings. Ticket [#30604](https://code.djangoproject.com/ticket/30604) added an error message to prevent this likely mistake:

```python
# Doesn't currently work:
ADMINS = ["john@example.com", "mary@example.com"]

```

#### Possible solutions

It’s a bug that these settings don’t work as documented. Here are some potential solutions. I’ll say up front that I don’t think the first two are good options, but I’m including them for completeness.

1. **Make the code match the docs:** Use something like Python’s [formataddr()](https://docs.python.org/3/library/email.utils.html#email.utils.formataddr) to build an RFC 5822 ‘name-addr’ string from the tuple. (I’d guess some early Django code did exactly this, resulting in the format for these settings.)

2. **Make the docs match the code:** This is probably the easiest solution, but doesn’t feel great. Something like:

3. **Change to lists of string addresses; deprecate tuples:** Update the code and documentation to expect lists of strings. Something like:

4. **Same as (3), but without deprecating tuples:** Change the documentation and code as above, but also continue to support lists of (name, email) tuples, without deprecation warnings.

Opinions?

* * *

1. There _is_ some support for (name, addr) pairs in django.core.mail’s internal sanitize\_address() helper. But as far as I can tell, using (name, addr) pairs has never been documented or tested in the public email APIs.

---

<div class="post-metadata">

**Author:** ![Lily-Foote](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@Lily-Foote](https://forum.djangoproject.com/u/Lily-Foote)\
**Post date:** [January 27, 2025, 9:56pm UTC](https://forum.djangoproject.com/t/simplifying-admins-and-managers-settings/38286/2 "2025-01-27T21:56:05Z")

</div>

Option 3 seems best here. There’s a bit of disruption with the deprecation cycle, but we have those for a reason and this ensures the best long term result.

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [January 28, 2025, 11:58pm UTC](https://forum.djangoproject.com/t/simplifying-admins-and-managers-settings/38286/3 "2025-01-28T23:58:26Z")

</div>

Option 3 seems good to me. If done, django-upgrade could quite easily gain a fixer for the change.
