settings.py
AUTH_USER_MODEL = "app_registration.MyUser"AUTH_PROfile_MODulE = 'app_registration.MyUserProfile'
models.py
class MyUserProfile(models.Model): user = models.ForeignKey(MyUser,unique=True) ... MyUser.profile = property(lambda u: MyUserProfile.objects.get_or_create(user=u)[0])
的login.HTML
所以我这样做是为我的自定义MyUser模型创建MyUserProfile模型.
一切正常,除了登录时(localhost / accounts / login),url被重定向到htp:// localhost:9999 / accounts / profile而不是我在表单隐藏输入中指定的索引页面.
这个重定向网址在哪里定义.. ??
最佳答案使用LOGIN_REDIRECT_URL:总结LOGIN_REDIRECT_URL
Default: ‘/accounts/profile/’
The URL where requests are redirected after login when the
contrib.auth.login vIEw gets no next parameter.This is used by the login_required() decorator,for example.
以上是内存溢出为你收集整理的python – Django的AUTH_PROFILE_MODULE更改登录成功网址?全部内容,希望文章能够帮你解决python – Django的AUTH_PROFILE_MODULE更改登录成功网址?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)