mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-09 13:22:18 -06:00
Closes #4997: Introduce OrderedDefaultRouter; move root API views to views.py
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
from rest_framework import routers
|
||||
|
||||
from utilities.api import OrderedDefaultRouter
|
||||
from . import views
|
||||
|
||||
|
||||
class TenancyRootView(routers.APIRootView):
|
||||
"""
|
||||
Tenancy API root view
|
||||
"""
|
||||
def get_view_name(self):
|
||||
return 'Tenancy'
|
||||
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.APIRootView = TenancyRootView
|
||||
router = OrderedDefaultRouter()
|
||||
router.APIRootView = views.TenancyRootView
|
||||
|
||||
# Tenants
|
||||
router.register('tenant-groups', views.TenantGroupViewSet)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from rest_framework.routers import APIRootView
|
||||
|
||||
from circuits.models import Circuit
|
||||
from dcim.models import Device, Rack, Site
|
||||
from extras.api.views import CustomFieldModelViewSet
|
||||
@@ -10,6 +12,14 @@ from virtualization.models import VirtualMachine
|
||||
from . import serializers
|
||||
|
||||
|
||||
class TenancyRootView(APIRootView):
|
||||
"""
|
||||
Tenancy API root view
|
||||
"""
|
||||
def get_view_name(self):
|
||||
return 'Tenancy'
|
||||
|
||||
|
||||
#
|
||||
# Tenant Groups
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user