我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.views.decorators.http.require_http_methods()。
def methods(*args): """ 1. Ensures only limited HTTP methods are supported. (for served models) 2. Register service function with only certain method on given @url """ def decorator(funcOrModel): if type(funcOrModel) is DjangoModel: funcOrModel._express_dispatcher = require_http_methods(args)(funcOrModel._express_dispatcher) else: funcOrModel._methods = args # this will be used later upon autodiscover() for creating service dispatcher (per url). return funcOrModel return decorator