views.py 文件源码

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

项目:lenuage 作者: laboiteproject 项目源码 文件源码
def get_prettyjson_html(api_key):
    boite = get_object_or_404(Boite, api_key=api_key)
    # Example from https://www.pydanny.com/pretty-formatting-json-django-admin.html
    response = json.dumps(boite.get_apps_dictionary(), sort_keys=True, indent=2)
    response = response[:5000]
    formatter = HtmlFormatter(style='friendly')
    response = highlight(response, JsonLexer(), formatter)
    style = "<style>" + formatter.get_style_defs() + "</style><br>"
    return mark_safe(style + response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号