def u_slugify(txt):
    """A custom version of slugify that retains non-ascii characters. The purpose of this
        function in the application is to make URLs more readable in a browser, so there are 
        some added heuristics to retain as much of the title meaning as possible while 
        excluding characters that are troublesome to read in URLs. For example, question marks 
        will be seen in the browser URL as %3F and are thereful unreadable. Although non-ascii
        characters will also be hex-encoded in the raw URL, most browsers will display them
        as human-readable glyphs in the address bar -- those should be kept in the slug."""
txt = txt.strip()
txt = re.sub('\\s*-\\s*', '-', txt, re.UNICODE)
txt = re.sub('[\\s/]', '_', txt, re.UNICODE)
txt = re.sub('(\\d):(\\d)', '\\1-\\2', txt, re.UNICODE)
txt = re.sub('"', "'", txt, re.UNICODE)
txt = re.sub('[?,:!@#~`+=$%^&\\\\*()\\[\\]{}<>]', '', txt, re.UNICODE)
return txt
Как заставить Django slugify правильно работать со строками Unicode?