diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py
index c228d5c3d..864d64dd0 100644
--- a/rest_framework/templatetags/rest_framework.py
+++ b/rest_framework/templatetags/rest_framework.py
@@ -41,7 +41,7 @@ def optional_login(request):
except NoReverseMatch:
return ''
- snippet = "
Log in" % (login_url, escape(request.path))
+ snippet = "Log in".format(href=login_url, next=escape(request.path))
return snippet
@@ -53,19 +53,19 @@ def optional_logout(request, user):
try:
logout_url = reverse('rest_framework:logout')
except NoReverseMatch:
- return '{0}'.format(user)
+ return '{user}'.format(user=user)
snippet = """
- {0}
+ {user}
"""
- return snippet.format(user, logout_url, escape(request.path))
+ return snippet.format(user=user, href=logout_url, next=escape(request.path))
@register.simple_tag