bootstrapped_goodies_tags.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:celery-monitor 作者: jimmy201602 项目源码 文件源码
def language_selector(context):
    """ displays a language selector dropdown in the admin, based on Django "LANGUAGES" context.
        requires:
            * USE_I18N = True / settings.py
            * LANGUAGES specified / settings.py (otherwise all Django locales will be displayed)
            * "set_language" url configured (see https://docs.djangoproject.com/en/dev/topics/i18n/translation/#the-set-language-redirect-view)
    """
    output = ""
    i18 = getattr(settings, 'USE_I18N', False)
    if i18:
        template = "admin/language_selector.html"
        context['i18n_is_set'] = True
        try:
            output = render_to_string(template, context)
        except:
            pass
    return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号