# -*- coding: utf-8 -*-
from django.template import defaultfilters

# TODO: Study whether this is enough, if Django does not do any strange stuff this should be enough to make it overwrite the slugify function in any case.

# Get the old slugifier
old_slugify = defaultfilters.slugify

def translat_slugify(str):
    char_translat = { 
        ("&auml;","&Auml;",) : "a",
        ("&ouml;","&Ouml;",) : "o",
    }

    for chars,trans in char_translat.items():
        for char in chars:
            str = str.replace(char.decode('utf-8'),trans)
    
    return old_slugify(str)


# "Overwrite" the old slugify
defaultfilters.slugify = translat_slugify
