Makes sure that a translation is created when a tag is saved.

    Also ensures that the original tag name gets updated when the english
    translation is updated.

    TODO: This will create two tags when a tag is saved through the admin

def tag_post_save_handler(sender, **kwargs):
    """
    Makes sure that a translation is created when a tag is saved.

    Also ensures that the original tag name gets updated when the english
    translation is updated.

    TODO: This will create two tags when a tag is saved through the admin

    """
    instance = kwargs.get('instance')
    try:
        translation = instance.tagtitle_set.get(language='en')
    except TagTitle.DoesNotExist:
        translation = TagTitle.objects.create(
            trans_name=instance.name, tag=instance, language='en')
    if translation.trans_name != instance.name:
        instance.name = translation.trans_name
        instance.save_base(raw=True)