class CustomRouter(routers.SimpleRouter): routes = [ # List route. routers.Route(url=r'^{prefix}{trailing_slash}$', mapping={'get': 'list'}, name='{basename}-list', initkwargs={'suffix': 'List'}), # Dynamically generated list routes. # Generated using @list_route decorator # on methods of the viewset. routers.DynamicListRoute( url=r'^{prefix}/{methodname}{trailing_slash}$', name='{basename}-{methodnamehyphen}', initkwargs={}), # Detail route. routers.Route(url=r'^{prefix}/{lookup}{trailing_slash}$', mapping={ 'get': 'retrieve', 'post': 'create', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy' }, name='{basename}-detail', initkwargs={'suffix': 'Instance'}), # Dynamically generated detail routes. # Generated using @detail_route decorator on methods of the viewset. routers.DynamicDetailRoute( url=r'^{prefix}/{lookup}/{methodname}{trailing_slash}$', name='{basename}-{methodnamehyphen}', initkwargs={}), ]
class OrderActionsRouter(routers.SimpleRouter): routes = [ routers.Route( url=r'^{prefix}/$', mapping={ 'get': 'retrieve', 'post': 'create', 'patch': 'partial_update', 'put': 'update', }, name='{basename}-detail', initkwargs={'suffix': 'Detail'} ), routers.DynamicDetailRoute( url=r'^{prefix}/{methodnamehyphen}/$', name='{basename}-{methodnamehyphen}', initkwargs={} ), routers.Route( url=r'{prefix}/pay/(?P<model_label>' + r'|'.join( i['key'].replace('.', '\.') for i in views.PaymentproviderListView.paymentproviders ) + r')/$', mapping={ 'post': 'pay', }, name='{basename}-pay', initkwargs={'suffix': 'Detail'}, ) ]
class RestRouter(routers.DefaultRouter): schema_title = "PeeringDB API" schema_url = "" schema_renderers = None routes = [ # List route. routers.Route( url=r"^{prefix}{trailing_slash}$", mapping={ "get": "list", "post": "create" }, name="{basename}-list", initkwargs={"suffix": "List"}, ), # Detail route. routers.Route( url=r"^{prefix}/{lookup}{trailing_slash}$", mapping={ "get": "retrieve", "put": "update", "patch": "partial_update", "delete": "destroy", }, name="{basename}-detail", initkwargs={"suffix": "Instance"}, ), routers.DynamicDetailRoute( url=r"^{prefix}/{lookup}/{methodnamehyphen}$", name="{basename}-{methodnamehyphen}", initkwargs={}, ), # Dynamically generated routes. # Generated using @action or @link decorators on methods of the # viewset. routers.Route( url=r"^{prefix}/{lookup}/{methodname}{trailing_slash}$", mapping={ "{httpmethod}": "{methodname}", }, name="{basename}-{methodnamehyphen}", initkwargs={}, ), ] def __init__(self, trailing_slash=False): self.trailing_slash = trailing_slash and "/" or "" super(routers.DefaultRouter, self).__init__(trailing_slash=False)
class RestRouter(routers.DefaultRouter): schema_title = "PeeringDB API" schema_url = "" schema_renderers = None routes = [ # List route. routers.Route(url=r'^{prefix}{trailing_slash}$', mapping={ 'get': 'list', 'post': 'create' }, name='{basename}-list', initkwargs={'suffix': 'List'}), # Detail route. routers.Route(url=r'^{prefix}/{lookup}{trailing_slash}$', mapping={ 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy' }, name='{basename}-detail', initkwargs={'suffix': 'Instance'}), routers.DynamicDetailRoute( url=r'^{prefix}/{lookup}/{methodnamehyphen}$', name='{basename}-{methodnamehyphen}', initkwargs={}), # Dynamically generated routes. # Generated using @action or @link decorators on methods of the # viewset. routers.Route(url=r'^{prefix}/{lookup}/{methodname}{trailing_slash}$', mapping={ '{httpmethod}': '{methodname}', }, name='{basename}-{methodnamehyphen}', initkwargs={}), ] def __init__(self, trailing_slash=False): self.trailing_slash = trailing_slash and '/' or '' super(routers.DefaultRouter, self).__init__(trailing_slash=False)
class SelfRouter(SimpleRouter): routes = [ routers.Route( url=r'^{prefix}{trailing_slash}$', mapping={ 'post': 'create', 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy', }, name='{basename}', initkwargs={'suffix': 'Instance'}, ), routers.DynamicDetailRoute( url=r'^{prefix}/{methodname}{trailing_slash}$', name='{basename}-{methodname}', initkwargs={} ) ]