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