Python django.views.generic.base.RedirectView 模块,as_view() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.views.generic.base.RedirectView.as_view()

项目:wiinaq    作者:futurulus    | 项目源码 | 文件源码
def subdir(view):
    def redirect_to_subdir(request, *args, **kwargs):
        if request.path.startswith(ALUTIIQ_SUBDIR):
            new_view = view
        else:
            new_view = RedirectView.as_view(url=ALUTIIQ_SUBDIR[:-1] + request.path,
                                            query_string=True)
        return new_view(request, *args, **kwargs)

    return redirect_to_subdir