from django.shortcuts import redirect
from django.contrib.auth import logout as auth_logout
from django.conf import settings


def logout(request):
    """Logs out user redirects if in request"""
    next = request.GET.get('next', '')
    auth_logout(request)

    response = None

    if next:
        response = redirect('{}/?next={}'.format(settings.OPENSTAX_ACCOUNTS_LOGOUT_URL, next))
    else:
        response = redirect(settings.OPENSTAX_ACCOUNTS_LOGOUT_URL)

    response.delete_cookie('_accounts_session')
    return response

@@ -193,19 +193,23 @@
 %22%22%22%0A    
-nex
+redirec
 t = requ
@@ -221,20 +221,17 @@
 ET.get('
-next
+r
 ', '')%0A 
@@ -283,19 +283,23 @@
 %0A    if 
-nex
+redirec
 t:%0A     
@@ -326,20 +326,17 @@
 ct('%7B%7D/?
-next
+r
 =%7B%7D'.for
@@ -382,11 +382,15 @@
 RL, 
-nex
+redirec
 t))%0A

change accounts logout redirect variable name