def get_next_url(request):
 if ('next' in request.POST):
  url = request.POST.get('next')
 elif ('next' in request.GET):
  url = request.GET.get('next')
 else:
  url = request.META.get('HTTP_REFERER')
 if ((not settings.DEBUG) and (not is_safe_url(url, Site.objects.get_current().domain))):
  return None
 return url

def get_next_url ( request ) : if ( 'next' in request . POST ) : url = request . POST . get ( 'next' ) elif ( 'next' in request . GET ) : url = request . GET . get ( 'next' ) else : url = request . META . get ( 'HTTP_REFERER' ) if ( ( not settings . DEBUG ) and ( not is_safe_url ( url , Site . objects . get_current ( ) . domain ) ) ) : return None return url
given a request object .