format_html was missing in optional_logout template-tag

The new format_html() was still missing in optional_logout template-tag
at the NoReverseMatch exception.
This commit is contained in:
Rense VanderHoek 2015-10-28 18:48:58 +01:00
parent 6aef157daa
commit 0d568ed59f

View File

@ -61,7 +61,8 @@ def optional_logout(request, user):
try:
logout_url = reverse('rest_framework:logout')
except NoReverseMatch:
return '<li class="navbar-text">{user}</li>'.format(user=user)
snippet = format_html('<li class="navbar-text">{user}</li>', user=escape(user))
return mark_safe(snippet)
snippet = """<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">