diff --git a/portal/forms/teach.py b/portal/forms/teach.py index 15f49e063..553bfa8d4 100644 --- a/portal/forms/teach.py +++ b/portal/forms/teach.py @@ -18,6 +18,13 @@ class InvitedTeacherForm(forms.Form): + prefix = 'teacher_signup' + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + for field_name, field in self.fields.items(): + field.widget.attrs['id'] = f'id_teacher_signup-{field_name}' + teacher_password = forms.CharField( help_text="Enter a password", widget=forms.PasswordInput( diff --git a/portal/templates/portal/teach/invited.html b/portal/templates/portal/teach/invited.html index 42f9c1504..6825276cf 100644 --- a/portal/templates/portal/teach/invited.html +++ b/portal/templates/portal/teach/invited.html @@ -20,7 +20,7 @@

Complete registration

-
+ {% csrf_token %} @@ -29,7 +29,9 @@

Complete registration

- {{ invited_teacher_form.teacher_password }} + {{ invited_teacher_form.teacher_password }} +
{{ invited_teacher_form.teacher_password.help_text }} {{ invited_teacher_form.teacher_password.errors }} @@ -37,7 +39,9 @@

Complete registration

- {{ invited_teacher_form.teacher_confirm_password }} + {{ invited_teacher_form.teacher_confirm_password }} +
{{ invited_teacher_form.teacher_confirm_password.help_text }} {{ invited_teacher_form.teacher_confirm_password.errors }} @@ -73,10 +77,14 @@

Complete registration

- +{% include "portal/partials/service_unavailable_popup.html" %} + -{% endblock content %} + + +{% endblock content %} \ No newline at end of file diff --git a/portal/tests/test_invite_teacher.py b/portal/tests/test_invite_teacher.py index 8251f6997..729a7d1ab 100644 --- a/portal/tests/test_invite_teacher.py +++ b/portal/tests/test_invite_teacher.py @@ -63,9 +63,9 @@ def test_invite_teacher_successful(self): response = client.post( invitation_url, { - "teacher_password": invited_teacher_password, - "teacher_confirm_password": invited_teacher_password, - "consent_ticked": "on", + "teacher_signup-teacher_password": invited_teacher_password, + "teacher_signup-teacher_confirm_password": invited_teacher_password, + "teacher_signup-consent_ticked": "on", }, )