Use unidecode to support slugify when containing characters other than letters and digits

E
• 25 Jan '15
def slugify(text, delim=u'-'):
text = unidecode.unidecode(text)
result = []
for word in _punct_re.split(text.lower()):
if word:
result.append(word)
return text_type(delim.join(result))



nitely
Esteban C Borsani
• 1
• 25 Jan '15

It's slightly more complicated than that... I'd rather wait for Django 1.8 to support it out of the box.

On a second thought, I'm not using forms.SlugField or the django's admin, so it might be all right.

nitely
Esteban C Borsani
• 29 Mar '15

I added support for this by including an extra dependency.