Update utils.py

This commit is contained in:
Ēriks Karls 2019-08-26 22:42:06 +03:00 committed by GitHub
parent fff17469e0
commit bbab84bf5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,5 +330,5 @@ def slugify(value, allow_unicode=False) -> str:
value = unicodedata.normalize('NFKC', value)
else:
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
value = re.sub(r'[^\w\s-]', '', value).strip().lower()
value = re.sub(r'[^\w\s-]', '_', value).strip().lower()
return re.sub(r'[-\s]+', '-', value)