Skip to content

Commit 226c9e3

Browse files
committed
Used username if provided
1 parent 5dd2bba commit 226c9e3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

appointment/utils/db_helpers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
APPOINTMENT_BUFFER_TIME, APPOINTMENT_FINISH_TIME, APPOINTMENT_LEAD_TIME, APPOINTMENT_PAYMENT_URL,
2525
APPOINTMENT_SLOT_DURATION, APPOINTMENT_WEBSITE_NAME
2626
)
27-
from appointment.utils.date_time import combine_date_and_time, get_current_year, get_weekday_num
27+
from appointment.utils.date_time import combine_date_and_time, get_weekday_num
2828

2929
Appointment = apps.get_model('appointment', 'Appointment')
3030
AppointmentRequest = apps.get_model('appointment', 'AppointmentRequest')
@@ -251,7 +251,10 @@ def create_user_with_email(client_data: dict):
251251

252252
def create_user_with_username(client_data: dict):
253253
CLIENT_MODEL = get_user_model()
254-
username = generate_unique_username_from_email(client_data['email'])
254+
if 'username' not in client_data:
255+
username = generate_unique_username_from_email(client_data['email'])
256+
else:
257+
username = client_data['username']
255258
user_data = {
256259
'username': username,
257260
'email': client_data['email'],

0 commit comments

Comments
 (0)