Skip to content

Commit

Permalink
chore: add username (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muchogoc committed Sep 3, 2022
1 parent 7ae2c0f commit 27dcf6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mycarehub/clients/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions mycarehub/clients/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions mycarehub/clients/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 27dcf6e

Please sign in to comment.