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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tms-django-router-1.0.0.tar.gz.
File metadata
- Download URL: tms-django-router-1.0.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f8dc6f461b6f13ca9a2b06cd33ba2389e36c1e3aecadec81ba38d529ed576df
|
|
| MD5 |
ff54b4a5aa783e909c1930c71954ef17
|
|
| BLAKE2b-256 |
bb5d9ef8cd95774a91b52e71a513b824830b850934bab647dff3801673801df1
|
File details
Details for the file tms_django_router-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tms_django_router-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5023d6db9fe86a46a9eaca65a4c86e52daf4561e64238b0e9e9a88effdbed6b8
|
|
| MD5 |
ded5beb2d9b7fcecd46a2f8ba70d556a
|
|
| BLAKE2b-256 |
60f0d27893b1dc1bb76289d0fb77f8b473f4bd28781c35b401a5aa54f843cbea
|