我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.views.decorators.http.condition()。
def get_conditional_response(self, *args, **kwargs): return condition( self.etag_func, self.last_modified_func )(super(self.__class__, self).dispatch)( *args, **kwargs )
def get_handler(self, request): handler = super().get_handler(request) if handler and self.method in ('get', 'head'): return condition( last_modified_func=self._last_modified, etag_func=self.etag, )(handler) else: return handler