utils.py 文件源码

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

项目:eduDjango 作者: yuzhou6 项目源码 文件源码
def get_context_dict(context):
    """
     Contexts in django version 1.9+ must be dictionaries. As xadmin has a legacy with older versions of django,
    the function helps the transition by converting the [RequestContext] object to the dictionary when necessary.
    :param context: RequestContext
    :return: dict
    """
    if isinstance(context, RequestContext):
        ctx = {}
        map(ctx.update, context.dicts)
    else:
        ctx = context
    return ctx
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号