Why second user login redirects me to /accounts/profile/ url?

前端 未结 7 2496
忘掉有多难
忘掉有多难 2021-02-03 19:13

I am using Django built in view for user login:

url(r\'^user/login/$\', \'django.contrib.auth.views.login\', {\'template_name\': \'users/templates/login.html\'},         


        
7条回答
  •  醉话见心
    2021-02-03 19:35

    Two ways, either you can use logout "LOGIN_REDIRECT_URL" or

    just use the url which redirects to the view method which has @login_required decorator

    example

    for second login , after logout (below code is in logout.html)

    Login again 
    

    In views.py

    @login_required
    def home(request):
      return HttpResponse("Welcome")
    

提交回复
热议问题