开发者

Django logout url with GET values

开发者 https://www.devze.com 2023-04-08 03:55 出处:网络
I have url config based on https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.logout

I have url config based on https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.logout

Here it is:

url(r'^logout(?P<next_page>.*)$', 'logout', name='auth_logout_next'),

In template I use such code:

<a href="{% url auth_logout_next request.path %}">{% trans "Logout" %}</a>

It works nice, yet I have possible GET value in some pages - ?page=2, so request.path drops those values. How should I pass not only the existing page but also GET values if po开发者_如何学运维ssible.


<a href="{% url auth_logout_next request.get_full_path|urlencode %}">{% trans "Logout" %}</a>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号