Last active
December 20, 2015 19:38
-
-
Save anhtran/6184368 to your computer and use it in GitHub Desktop.
Create slug for URL from string in Django. Fixing the issue with character "đ" in Vietnamse.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.utils.text import slugify | |
def slugify_vietnamese(value): | |
value = value.replace(u'đ', 'd').replace(u'Đ', 'D') | |
return slugify(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment