Add greenmine version router subclass.
parent
e86f393bfd
commit
ef2137a045
|
@ -0,0 +1,12 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from rest_framework import routers
|
||||||
|
|
||||||
|
# Special router for actions.
|
||||||
|
actions_router = routers.Route(url=r'^{prefix}/actions/{methodname}{trailing_slash}$',
|
||||||
|
mapping={'{httpmethod}': '{methodname}'},
|
||||||
|
name='{basename}-{methodnamehyphen}',
|
||||||
|
initkwargs={})
|
||||||
|
|
||||||
|
class Router(routers.DefaultRouter):
|
||||||
|
routes = routers.DefaultRouter.routes + [actions_router]
|
|
@ -1,19 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from rest_framework.urlpatterns import format_suffix_patterns
|
|
||||||
from rest_framework import routers
|
|
||||||
|
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
from greenmine.base import api
|
from greenmine.base import api, routers
|
||||||
|
|
||||||
# Special router for actions.
|
router = routers.Router(trailing_slash=False)
|
||||||
actions_router = routers.Route(url=r'^{prefix}/actions/{methodname}{trailing_slash}$',
|
|
||||||
mapping={'{httpmethod}': '{methodname}'},
|
|
||||||
name='{basename}-{methodnamehyphen}',
|
|
||||||
initkwargs={})
|
|
||||||
|
|
||||||
router = routers.DefaultRouter(trailing_slash=False)
|
|
||||||
router.routes.append(actions_router)
|
|
||||||
router.register("users", api.UsersViewSet, base_name="users")
|
router.register("users", api.UsersViewSet, base_name="users")
|
||||||
router.register("roles", api.RolesViewSet, base_name="roles")
|
router.register("roles", api.RolesViewSet, base_name="roles")
|
||||||
router.register("search", api.Search, base_name="search")
|
router.register("search", api.Search, base_name="search")
|
||||||
|
|
Loading…
Reference in New Issue