Skip to content

Instantly share code, notes, and snippets.

@anhtran
Last active December 20, 2015 19:38
Show Gist options
  • Save anhtran/6184368 to your computer and use it in GitHub Desktop.
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.
# -*- 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