mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-25 12:59:59 -06:00
Converted static URL definitions to routers
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
from django.conf.urls import url
|
||||
from django.conf.urls import include, url
|
||||
|
||||
from .views import *
|
||||
from rest_framework import routers
|
||||
|
||||
from views import TenantViewSet, TenantGroupViewSet
|
||||
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'tenant-groups', TenantGroupViewSet)
|
||||
router.register(r'tenants', TenantViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
# Tenant groups
|
||||
url(r'^tenant-groups/$', TenantGroupViewSet.as_view({'get': 'list'}), name='tenantgroup_list'),
|
||||
url(r'^tenant-groups/(?P<pk>\d+)/$', TenantGroupViewSet.as_view({'get': 'retrieve'}), name='tenantgroup_detail'),
|
||||
|
||||
# Tenants
|
||||
url(r'^tenants/$', TenantViewSet.as_view({'get': 'list'}), name='tenant_list'),
|
||||
url(r'^tenants/(?P<pk>\d+)/$', TenantViewSet.as_view({'get': 'retrieve'}), name='tenant_detail'),
|
||||
url(r'', include(router.urls)),
|
||||
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user