def next_url(request):
 next = request.GET.get(u'next', request.POST.get(u'next', u''))
 host = request.get_host()
 return (next if (next and is_safe_url(next, host=host)) else None)

def next_url ( request ) : next = request . GET . get ( u'next' , request . POST . get ( u'next' , u'' ) ) host = request . get_host ( ) return ( next if ( next and is_safe_url ( next , host = host ) ) else None )
returns url to redirect to from the next param in the request .