django base view get_context_data how to redirect
from django.views.generic.base import TemplateView
class HomePageView(TemplateView):
template_name = "home.html"
def get_context_data(self, **kwargs):
context = super(HomePageView, self).get_context_data(**kwargs)
redirect_to = self.request.REQUEST.get("redirect", None)
if redirect_to:
#我想在这里获取地址并且跳转怎么做
#我用 shortcuts.redirect() 什么的都没效果
context = 'test'
return context