Skip to content

Instantly share code, notes, and snippets.

@pricco
Created April 2, 2013 18:32
Show Gist options
  • Save pricco/5294873 to your computer and use it in GitHub Desktop.
Save pricco/5294873 to your computer and use it in GitHub Desktop.
Remove accents django filter.
import unicodedata
from django import template
register = template.Library()
@register.filter
def remove_accents(value):
nkfd_form = unicodedata.normalize('NFKD', unicode(value))
return u"".join([c for c in nkfd_form if not unicodedata.combining(c)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment