views.py 文件源码

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

项目:django-iitg-auth 作者: narenchoudhary 项目源码 文件源码
def form_valid(self, form):
        """
        This method is executed when submitted form is valid.

        It redirects to ``success_url`` if no ``next`` url is provided.
        Otherwise it redirects to ``next`` url.

        :param form: ``forms.Form`` instance
        :return: ``HttpResponse`` instance
        """
        redirect_to = self.request.POST.get('next', '')
        auth.login(self.request, form.user_cache)
        # check if next is a valid url
        if not is_safe_url(redirect_to, self.request.get_host()):
            return super(WebmailLoginView, self).form_valid(form)
        else:
            return redirect(redirect_to)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号