Decode username back to string from bytes after encode
This commit is contained in:
parent
4441ba37ca
commit
e18188603a
1 changed files with 3 additions and 1 deletions
|
@ -96,7 +96,9 @@ def assign_username(user):
|
|||
|
||||
# Try to come up with a username
|
||||
first_name, last_name = get_first_and_last_name(user.name)
|
||||
user.username = unicodedata.normalize('NFKD', first_name + last_name).encode('ascii', 'ignore')
|
||||
user.username = unicodedata.normalize(
|
||||
'NFKD', first_name + last_name
|
||||
).encode('ascii', 'ignore').decode('ascii', 'ignore')
|
||||
user.username = "".join([char for char in user.username if char.isalnum()]).lower()
|
||||
if user.username.strip() == "":
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue