A Django Restframework router that can show APIViews and include other routers as navigable urls in the root view.
Project description
Django Browsable Router
pip install django-browsable-router
A Django Restframework router that can show APIViews and include other routers as navigable urls in the root view.
from browsable_router import APIRouter
from restframework.views import APIView
from restframework.viewsets import ViewSet
class TestView(APIView):
...
class TestViewSet(ViewSet):
...
router_1 = APIRouter()
router_1.format_root_view("other_routes", "These are under a different route.")
router_1.register(r"view-1", TestView.as_view(), "view_1")
router_1.register(r"view-2", TestViewSet.as_view(), "view_2")
router_2 = APIRouter()
router_2.register(r"view-3", TestView.as_view(), "view_3")
router_2.navigation_routes = {
"route": router_1,
}
urlpatterns = [
path("api/", include(router_2.urls))
]
Resulting browsable API:
# API Root:
# """API root."""
#
# "route": "/api/route/"
# "view-3": "/api/view-3/"
#
# Other Routes:
# """These are under a different route."""
#
# "view-1": "/api/route/view-1/"
# "view-2": "/api/route/view-2/"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-browsable-router-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64a31e6f50b07bb233df337a80647975e8d66b5fd3d3cc0054fec9ef0ff4d9df |
|
MD5 | b9ceb6f1dafa15be5873a7604a9cab69 |
|
BLAKE2b-256 | 011f303a5f896ffff2851e9cc35071a57ac72d180fa73d11b65a19eb684afcef |
Close
Hashes for django_browsable_router-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 842ecbc93808c8a3dcbb5af83749aa8bcaf814a8e9275c1b881d8e6c8b23fc04 |
|
MD5 | e95721c1f0d122a5688dd2afe06c5cc0 |
|
BLAKE2b-256 | f2dde26b8e82f053e7df406195d88e4a221cdb215d2fbd0799ebb18082cad291 |