人们使用Django注册进行注册后如何重定向他们 [英] How to redirect people after they register using django registration

查看:75
本文介绍了人们使用Django注册进行注册后如何重定向他们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

url(r'^register/$',
    RegistrationView.as_view(form_class=CustomRegistrationForm,
                             success_url='/profile'),
    name='registration_register',
    success_url='/profile'),

我的urls.py中包含以下内容.

I have the following in my urls.py.

当人们使用Django Registration 1.0注册后,如何重定向他们?

How do I redirect people after they register using django registration 1.0?

推荐答案

重定向将发布到 RegistrationView.get_success_url 指定的路径,该路径应为 RegistrationView.success_url 在构造视图函数时指定的.

The redirect will be issued to the path specified by RegistrationView.get_success_url, which should be RegistrationView.success_url which you've specified when constructing the view function.

您可以查看 RequestView.form_valid 了解更多详细信息.

You can review RequestView.form_valid for more details.

这篇关于人们使用Django注册进行注册后如何重定向他们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆