def ajax_required(f):
 @wraps(f)
 def wrapper(request, *args, **kwargs):
  if ((not settings.DEBUG) and (not request.is_ajax())):
   return HttpResponseBadRequest('This must be an AJAX request.')
  return f(request, *args, **kwargs)
 return wrapper

def ajax_required ( f ) : @ wraps ( f ) def wrapper ( request , * args , ** kwargs ) : if ( ( not settings . DEBUG ) and ( not request . is_ajax ( ) ) ) : return HttpResponseBadRequest ( 'This must be an AJAX request.' ) return f ( request , * args , ** kwargs ) return wrapper
check that the request is an ajax request .