[Django] #36138: Simplify ADMINS and MANAGERS email list settings

25 views
Skip to first unread message

Django

unread,
Jan 25, 2025, 3:52:24 PMJan 25
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+---------------------------------------
Reporter: Mike Edmunds | Type: New feature
Status: new | Component: Core (Mail)
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+---------------------------------------
Django should allow the
[https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-ADMINS
ADMINS] and [https://docs.djangoproject.com/en/5.1/ref/settings/#managers
MANAGERS] settings to be simple lists of email addresses, like this:

{{{#!python
# Doesn't work in Django through 5.2:
ADMINS = ["jo...@example.com", "ma...@example.com"]
}}}

Right now, those settings both expect a list of tuples of (full name,
email address). But the name part ''is ignored'' in both
[https://github.com/django/django/blob/main/django/core/mail/__init__.py#L134
mail_admins()] and
[https://github.com/django/django/blob/330d89d4fe7832355535580383523f1749a3ee45/django/core/mail/__init__.py#L154
mail_managers()]—and it's
[https://github.com/django/django/blob/ed114e15106192b22ebb78ef5bf5bce72b419d13/django/core/mail.py#L43-L51
been ignored] for at least 20 years (as far back as the Git history goes):

{{{#!python
ADMINS = [("name is ignored", "jo...@example.com"), ("ignored",
"ma...@example.com)]
}}}

#30604 added an error on detecting the (reasonable) mistake of trying to
set ADMINS or MANAGERS to a simple list of addresses as in first example.

This ticket proposes instead allowing—and documenting—simple address lists
in these settings. For compatibility, Django would also continue to
support the list-of-tuples form (with the name field ignored).

Incidentally, if you ''do'' want to include a display-name in the
admins/managers recipients lists, that can be done with the RFC 5322
`"name" <addr>` format (which is accepted by all the django.core.mail
APIs):

{{{#!python
# Works in Django 5.2 and earlier:
ADMINS = [
("ignored", "John <jo...@example.com>"),
("ignored", '"Mary, IT (Ops)" <ma...@example.com>'),
]

# Also allowed after this proposed change:
ADMINS = [
"John <jo...@example.com>",
'"Mary, IT (Ops)" <ma...@example.com>',
]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36138>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 27, 2025, 3:22:37 AMJan 27
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+--------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: New feature | Status: closed
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Sarah Boyce):

* resolution: => wontfix
* status: new => closed

Comment:

Thank you for the ticket!

I think this is a good suggestion, however can you raise this on the
[https://forum.djangoproject.com/c/internals/5 Django forum] first as I
want to check the community appetite on:
- should we deprecate the tuple? I understand that's a change to almost
every project but not a particularly difficult change (django-upgrade
could automate this for example).
- if we don't deprecate it, we have two ways of doing this. Are we
comfortable with that?

I'll close the ticket for now, but if we have agreement whether to
deprecate or not, please return to this ticket and reference the forum
discussion so we can re-open it. For more information, please refer to
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features the documented guidelines for requesting
features].
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:1>

Django

unread,
Jan 27, 2025, 3:56:06 PMJan 27
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+--------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: New feature | Status: closed
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Comment (by Mike Edmunds):

https://forum.djangoproject.com/t/simplifying-admins-and-managers-
settings/38286
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:2>

Django

unread,
Jan 31, 2025, 3:16:10 PMJan 31
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+--------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: New feature | Status: new
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Mike Edmunds):

* resolution: wontfix =>
* status: closed => new


Old description:
New description:

Django should allow the
[https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-ADMINS
ADMINS] and [https://docs.djangoproject.com/en/5.1/ref/settings/#managers
MANAGERS] settings to be simple lists of email addresses, like this:

{{{#!python
# Doesn't work in Django through 5.2:
ADMINS = ["jo...@example.com", "ma...@example.com"]
}}}

Right now, those settings both expect a list of tuples of (full name,
email address). But the name part ''is ignored'' in both
[https://github.com/django/django/blob/main/django/core/mail/__init__.py#L134
mail_admins()] and
[https://github.com/django/django/blob/330d89d4fe7832355535580383523f1749a3ee45/django/core/mail/__init__.py#L154
mail_managers()]—and it's
[https://github.com/django/django/blob/ed114e15106192b22ebb78ef5bf5bce72b419d13/django/core/mail.py#L43-L51
been ignored] for at least 20 years (as far back as the Git history goes):

{{{#!python
ADMINS = [("name is ignored", "jo...@example.com"), ("ignored",
"ma...@example.com)]
}}}

#30604 added an error on detecting the (reasonable) mistake of trying to
set ADMINS or MANAGERS to a simple list of addresses as in first example.

This ticket proposes instead allowing—and documenting—simple address lists
in these settings. For compatibility __during a standard deprecation
period__, Django would also continue to support the list-of-tuples form
(with the name field ignored). __After deprecation, tuples would raise an
error.__ [Edits: deprecated tuples, based on forum discussion.]

Incidentally, if you ''do'' want to include a display-name in the
admins/managers recipients lists, that can be done with the RFC 5322
`"name" <addr>` format (which is accepted by all the django.core.mail
APIs):

{{{#!python
# Works in Django 5.2 and earlier:
ADMINS = [
("ignored", "John <jo...@example.com>"),
("ignored", '"Mary, IT (Ops)" <ma...@example.com>'),
]

# Also allowed after this proposed change:
ADMINS = [
"John <jo...@example.com>",
'"Mary, IT (Ops)" <ma...@example.com>',
]
}}}

--
Comment:

Reopened, deprecating the tuples, based on forum feedback.
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:3>

Django

unread,
Feb 2, 2025, 3:16:34 PMFeb 2
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Mike Edmunds):

* owner: (none) => Mike Edmunds
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:4>

Django

unread,
Feb 3, 2025, 3:14:54 AMFeb 3
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

Comment:

Thank you for getting feedback
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:5>

Django

unread,
Feb 5, 2025, 3:10:20 PMFeb 5
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Mike Edmunds):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:6>

Django

unread,
Feb 5, 2025, 11:49:59 PMFeb 5
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Mike Edmunds):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:7>

Django

unread,
Feb 6, 2025, 1:04:41 PMFeb 6
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Mike Edmunds):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:8>

Django

unread,
Mar 17, 2025, 8:52:05 AMMar 17
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Sarah Boyce):

* needs_docs: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:9>

Django

unread,
Mar 17, 2025, 5:47:48 PMMar 17
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Changes (by Mike Edmunds):

* needs_docs: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:10>

Django

unread,
Mar 18, 2025, 5:08:19 AMMar 18
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"62ad970c39c067dd30b068cb9ad04a93963bebb4" 62ad970]:
{{{#!CommitTicketReference repository=""
revision="62ad970c39c067dd30b068cb9ad04a93963bebb4"
Refs #36138 -- Improved tests for mail_admins() and mail_managers().

- Separated MailTests.test_connection_arg test cases.
- Expanded test cases for incorrect values of ADMINS/MANAGERS settings.
- Added test case verifying correct values of ADMINS/MANAGERS settings.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:11>

Django

unread,
Mar 18, 2025, 5:08:19 AMMar 18
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+----------------------------------------
Reporter: Mike Edmunds | Owner: Mike Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"90fc76294808b16a86acc9a073435250466932e3" 90fc7629]:
{{{#!CommitTicketReference repository=""
revision="90fc76294808b16a86acc9a073435250466932e3"
Refs #36138 -- Cleaned up duplicate code in mail_admins()/mail_managers().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:12>

Django

unread,
Mar 19, 2025, 10:10:01 AMMar 19
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Mike
| Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:13>

Django

unread,
Mar 20, 2025, 7:26:39 PMMar 20
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Natita25
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natita25):

* owner: Mike Edmunds => Natita25

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:14>

Django

unread,
Mar 20, 2025, 10:11:32 PMMar 20
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Mike
| Edmunds
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Edmunds):

* owner: Yohaselin Carrizo Muñoz => Mike Edmunds

--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:15>

Django

unread,
Mar 21, 2025, 5:18:09 AMMar 21
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Mike
| Edmunds
Type: New feature | Status: closed
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"e295033144e3085abaf9277d1bb0a6436ce73e01" e2950331]:
{{{#!CommitTicketReference repository=""
revision="e295033144e3085abaf9277d1bb0a6436ce73e01"
Fixed #36138 -- Changed ADMINS and MANAGERS settings to lists of strings.

Previously, the ADMINS and MANAGERS settings were lists of (name, address)
tuples (where the name had been unused). Deprecated use of tuples.

Updated settings value sanity checks, and changed from ValueError to
ImproperlyConfigured.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:14>

Django

unread,
Jul 22, 2025, 7:54:06 AMJul 22
to django-...@googlegroups.com
#36138: Simplify ADMINS and MANAGERS email list settings
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Mike
| Edmunds
Type: New feature | Status: closed
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"a8536e33da6365fb7bba901a06a67d163d0d4c8a" a8536e3]:
{{{#!CommitTicketReference repository=""
revision="a8536e33da6365fb7bba901a06a67d163d0d4c8a"
Refs #36138 -- Corrected ADMINS setting format in
django/conf/global_settings.py comment.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36138#comment:15>
Reply all
Reply to author
Forward
0 new messages