How to specify the login_required redirect url in django?

后端 未结 7 1263
既然无缘
既然无缘 2020-12-13 23:04

I have a view function:

@login_required
def myview():
    # do something
    # respond something
    pass

How can I specify the exact URL f

7条回答
  •  悲&欢浪女
    2020-12-13 23:50

    this from documentation should be helpful: https://docs.djangoproject.com/en/1.5/topics/auth/default/#the-login-required-decorator

    @login_required(login_url='/accounts/login/')
    def my_view(request):
        ...
    

提交回复
热议问题