Django logout url with GET values
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>
精彩评论