Correct construction for a reverse URL in an edge case. Fixes #2815. Commit ready for merge.
- Legacy-Id: 16907
This commit is contained in:
parent
f2758fe49c
commit
cca04b6330
|
@ -382,7 +382,7 @@ class NominateNewPersonForm(forms.ModelForm):
|
|||
def clean_candidate_email(self):
|
||||
candidate_email = self.cleaned_data['candidate_email']
|
||||
if Email.objects.filter(address=candidate_email).exists():
|
||||
normal_url_name = 'ietf.nomcom.views.%s_nominate' % 'public' if self.public else 'private'
|
||||
normal_url_name = 'ietf.nomcom.views.%s_nominate' % ('public' if self.public else 'private')
|
||||
msg = (('%s is already in the datatracker. '
|
||||
'Use the <a href="%s">normal nomination form</a> to nominate the person '
|
||||
'with this address. ') %
|
||||
|
|
|
@ -584,6 +584,11 @@ class NomcomViewsTest(TestCase):
|
|||
return self.nominate_newperson_view(public=False)
|
||||
self.client.logout()
|
||||
|
||||
def test_private_nominate_newperson_who_already_exists(self):
|
||||
EmailFactory(address='nominee@example.com')
|
||||
self.access_member_url(self.private_nominate_newperson_url)
|
||||
return self.nominate_newperson_view(public=False)
|
||||
|
||||
def test_public_nominate_with_automatic_questionnaire(self):
|
||||
nomcom = get_nomcom_by_year(self.year)
|
||||
nomcom.send_questionnaire = True
|
||||
|
@ -715,6 +720,12 @@ class NomcomViewsTest(TestCase):
|
|||
if not public:
|
||||
test_data['nominator_email'] = nominator_email
|
||||
|
||||
if Email.objects.filter(address=nominee_email).exists():
|
||||
response = self.client.post(nominate_url, test_data,follow=True)
|
||||
self.assertFalse(response.redirect_chain)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('already in the datatracker',unicontent(response))
|
||||
else:
|
||||
response = self.client.post(nominate_url, test_data,follow=True)
|
||||
self.assertTrue(response.redirect_chain)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
|
Loading…
Reference in a new issue