diff --git a/opentech/apply/funds/blocks.py b/opentech/apply/funds/blocks.py index ad00ba86fbec8f4af244e45f65838c6748fa10d2..d6a87a5f919876520865192f3e1dde137a13a782 100644 --- a/opentech/apply/funds/blocks.py +++ b/opentech/apply/funds/blocks.py @@ -44,6 +44,7 @@ class EmailBlock(ApplicationMustIncludeFieldBlock): name = 'email' description = 'The applicant email address' widget = forms.EmailInput + field_class = forms.EmailField class Meta: icon = 'mail' diff --git a/opentech/apply/funds/tests/test_models.py b/opentech/apply/funds/tests/test_models.py index 5943d8b769d890264a5198dfe793c1e1a7832922..b606227e4783889a66639830798ac5bcbc248c78 100644 --- a/opentech/apply/funds/tests/test_models.py +++ b/opentech/apply/funds/tests/test_models.py @@ -306,6 +306,11 @@ class TestFormSubmission(TestCase): self.assertEqual(ApplicationSubmission.objects.count(), 0) + def test_valid_email(self): + email = 'not_a_valid_email@' + response = self.submit_form(email=email, ignore_errors=True) + self.assertContains(response, 'Enter a valid email address') + @override_settings(SEND_MESSAGES=True) def test_email_sent_to_user_on_submission_fund(self): self.submit_form()