mirror of
https://github.com/django/django.git
synced 2025-03-05 15:02:31 +00:00
Removed duplicate lines in slugify().
This commit is contained in:
parent
eac396a5d0
commit
b906c3db63
@ -412,8 +412,7 @@ def slugify(value, allow_unicode=False):
|
|||||||
value = force_text(value)
|
value = force_text(value)
|
||||||
if allow_unicode:
|
if allow_unicode:
|
||||||
value = unicodedata.normalize('NFKC', value)
|
value = unicodedata.normalize('NFKC', value)
|
||||||
value = re.sub(r'[^\w\s-]', '', value).strip().lower()
|
else:
|
||||||
return mark_safe(re.sub(r'[-\s]+', '-', value))
|
|
||||||
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
|
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 mark_safe(re.sub(r'[-\s]+', '-', value))
|
return mark_safe(re.sub(r'[-\s]+', '-', value))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user