本文介绍了在Django中登录/ account / profile /的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经为用户创建了用户个人资料,并且已经添加了
I have created user profiles for the user and already added
AUTH_PROFILE_MODULE = 'app.ModelName'
但是当用户成功登录时,默认情况下他/她将被重定向到/ accounts / profile /。
But when the user successfully logs in, he/she are redirected to /accounts/profile/ by default.
如何更改?我希望他们去/ profile /并为他们创建一个视图。
How to change this? I would like them to go /profile/ and have created a view for them.
def Profile(request):
'''
profile view
'''
return render(request,'profile.html')
推荐答案
更改在您的settings.py。
Change the value of LOGIN_REDIRECT_URL in your settings.py.
这篇关于在Django中登录/ account / profile /的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!