diff --git a/mycarehub/clients/forms.py b/mycarehub/clients/forms.py index d888eb0..1224ba4 100644 --- a/mycarehub/clients/forms.py +++ b/mycarehub/clients/forms.py @@ -46,6 +46,13 @@ class ClientRegistrationForm(forms.Form): help_text="The client's full name i.e family, given and other names, on one row", ) + handle = forms.CharField( + required=True, + max_length=255, + label="Username", + help_text="The client's unique username", + ) + gender = forms.ChoiceField( required=True, choices=GenderChoices.choices, diff --git a/mycarehub/clients/tests/test_views.py b/mycarehub/clients/tests/test_views.py index a03a8d8..5f3f341 100644 --- a/mycarehub/clients/tests/test_views.py +++ b/mycarehub/clients/tests/test_views.py @@ -276,6 +276,7 @@ def test_client_registration_view_valid(user_with_all_permissions, client): url, data={ "user_id": fake.uuid4(), + "handle": fake.name(), "facility_id": facility.id, "organisation_id": org.id, "facility_name": facility.name, diff --git a/mycarehub/clients/views.py b/mycarehub/clients/views.py index ab275d2..e0067d9 100644 --- a/mycarehub/clients/views.py +++ b/mycarehub/clients/views.py @@ -89,6 +89,7 @@ def post(self, request, format=None): id=data["user_id"], defaults={ "name": data["name"], + "username": data["handle"], "gender": data["gender"], "date_of_birth": data["date_of_birth"], "user_type": "CLIENT",