Hybrid DRF Router
Project description
DRF Hybdrid Router
Install the package
pip install tms_django_router
The router can be instanciate this way:
from tms_django_router.routers import HybridRouter
router = HybridRouter()
Then it can use the same register
method than the original DRF DefaultRouter
from tms_django_router.routers import HybridRouter
from mypackage import views
router = routers.HybridRouter()
router.register(r"endpoint", views.MyViewSet)
And provides a way to add api view to DRF browsable api without using viewsets:
from django.urls import path
router.add_api_view(
"another",
path(
"version/",
views.MyView.as_view(),
name="another",
),
)
Then the urls can be included the same way than DefaultRouter
:
from django.urls import include
urls = [
path("api/", include(router.urls))
]
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 tms_django_router-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3bca86921e78936b3e202e746b2094f20fffe94268639a29abeacc3b8a00173 |
|
MD5 | 3db5b848481e7de286847eda5c94b849 |
|
BLAKE2b-256 | c344ddcea320ea18b41ddcdfb4965458d6e2e93b5a64174472a62a95068b20ca |