def ssl_required(view_func):
 @wraps(view_func)
 def _checkssl(request, *args, **kwargs):
  if (settings.SESSION_COOKIE_SECURE and (not request.is_secure())):
   url_str = request.build_absolute_uri()
   url_str = url_str.replace('http://', 'https://')
   return http.HttpResponseRedirect(url_str)
  return view_func(request, *args, **kwargs)
 return _checkssl

def ssl_required ( view_func ) : @ wraps ( view_func ) def _checkssl ( request , * args , ** kwargs ) : if ( settings . SESSION_COOKIE_SECURE and ( not request . is_secure ( ) ) ) : url_str = request . build_absolute_uri ( ) url_str = url_str . replace ( 'http://' , 'https://' ) return http . HttpResponseRedirect ( url_str ) return view_func ( request , * args , ** kwargs ) return _checkssl
a view decorator that enforces https .