如何配置到哪里在Django一个注销后重定向? [英] How to configure where to redirect after a log out in Django?
本文介绍了如何配置到哪里在Django一个注销后重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是想知道我在哪里可以设置URL注销后重定向到。我知道你可以设置登录URL。我想重定向到我的主页。
Just wondering where I can set the url to redirect to after logout. I know you can set the login url. I want to redirect to my home page.
推荐答案
您不需要覆盖或包裹东西。
You don't need to overwrite or wrap anything.
根据文档,你可以提供 next_page
参数注销视图。
<一href=\"https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.views.logout\">https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.views.logout
According to the docs, you can just supply the next_page
argument to the logout view.
https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.views.logout
(r'^logout/$', 'django.contrib.auth.views.logout',
{'next_page': '/successfully_logged_out/'})
这篇关于如何配置到哪里在Django一个注销后重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文