From c5ca0ea40575d93c0963480c410c2c278e9fa068 Mon Sep 17 00:00:00 2001 From: Ryan Cross Date: Sat, 20 Jul 2024 15:24:14 -0700 Subject: [PATCH] fix: force choice of From address in Announcement form. Fixes #7679. (#7720) --- ietf/secr/announcement/forms.py | 7 +++++-- ietf/secr/announcement/tests.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ietf/secr/announcement/forms.py b/ietf/secr/announcement/forms.py index 3aacbfe622..3fe58bdaaa 100644 --- a/ietf/secr/announcement/forms.py +++ b/ietf/secr/announcement/forms.py @@ -42,8 +42,11 @@ def get_from_choices(user): nomcom_choices = get_nomcom_choices(user) if nomcom_choices: addresses = list(addresses) + nomcom_choices - - return list(zip(addresses, addresses)) + + choices = list(zip(addresses, addresses)) + if len(choices) > 1: + choices.insert(0, ('', '(Choose an option)')) + return choices def get_nomcom_choices(user): diff --git a/ietf/secr/announcement/tests.py b/ietf/secr/announcement/tests.py index c50e997f97..c147c301b6 100644 --- a/ietf/secr/announcement/tests.py +++ b/ietf/secr/announcement/tests.py @@ -48,7 +48,7 @@ def test_main_announce_from(self): r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) - self.assertEqual(len(q('#id_frm option')),3) + self.assertEqual(len(q('#id_frm option')),4) # IAB Chair self.client.login(username="iab-chair", password="iab-chair+password")