def model_view_set(injector): """Create DRF model view set from injector class.""" handler = create_handler(ModelViewSet, injector) apply_api_view_attributes(handler, injector) apply_generic_api_view_attributes(handler, injector) apply_model_view_set_methods(handler, injector) return injector.let(as_viewset=lambda: handler)
def generic_api_view(injector): """Create DRF generic class-based API view from injector class.""" handler = create_handler(GenericAPIView, injector) apply_http_methods(handler, injector) apply_api_view_attributes(handler, injector) apply_generic_api_view_attributes(handler, injector) return injector.let(as_view=handler.as_view)
def view_set(injector): """Create DRF view set from injector class.""" # FIXME: # # [ ] Test me. # # [ ] Doc me. handler = create_handler(ViewSet, injector) apply_api_view_attributes(handler, injector) apply_view_set_methods(handler, injector) return injector.let(as_viewset=lambda: handler)
def list_api_view(injector): """Create DRF view for listing a queryset from injector class.""" # FIXME: # # [ ] Test me. # # [ ] Doc me. handler = create_handler(ListAPIView, injector) apply_api_view_attributes(handler, injector) apply_generic_api_view_attributes(handler, injector) return injector.let(as_view=handler.as_view)
def retrieve_api_view(injector): """Create DRF view for retrieving a model instance from injector class.""" # FIXME: # # [ ] Write separate test module for each public function. # # [ ] Test me. # # [ ] Doc me. handler = create_handler(RetrieveAPIView, injector) apply_api_view_attributes(handler, injector) apply_generic_api_view_attributes(handler, injector) return injector.let(as_view=handler.as_view)