def require_http_methods(request_method_list):
 def decorator(func):
  def inner(request, *args, **kwargs):
   if (request.method not in request_method_list):
    return HttpResponseNotAllowed(request_method_list)
   return func(request, *args, **kwargs)
  return inner
 return decorator

def require_http_methods ( request_method_list ) : def decorator ( func ) : def inner ( request , * args , ** kwargs ) : if ( request . method not in request_method_list ) : return HttpResponseNotAllowed ( request_method_list ) return func ( request , * args , ** kwargs ) return inner return decorator
decorator to make a view only accept particular request methods .