From ef1fb3d8df8227961e3b24d1955af93be13519ea Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 4 Sep 2014 08:54:50 +0200 Subject: [PATCH] Prefer `format` and use named blocks --- rest_framework/templatetags/rest_framework.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 ''.format(user) + return ''.format(user=user) snippet = """""" - return snippet.format(user, logout_url, escape(request.path)) + return snippet.format(user=user, href=logout_url, next=escape(request.path)) @register.simple_tag