mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #1556: Added API endpoints listing static field choices for each app
This commit is contained in:
@@ -16,6 +16,9 @@ class TenancyRootView(routers.APIRootView):
|
||||
router = routers.DefaultRouter()
|
||||
router.APIRootView = TenancyRootView
|
||||
|
||||
# Field choices
|
||||
router.register(r'_choices', views.TenancyFieldChoicesViewSet, base_name='field-choice')
|
||||
|
||||
# Tenants
|
||||
router.register(r'tenant-groups', views.TenantGroupViewSet)
|
||||
router.register(r'tenants', views.TenantViewSet)
|
||||
|
@@ -5,10 +5,18 @@ from rest_framework.viewsets import ModelViewSet
|
||||
from extras.api.views import CustomFieldModelViewSet
|
||||
from tenancy import filters
|
||||
from tenancy.models import Tenant, TenantGroup
|
||||
from utilities.api import WritableSerializerMixin
|
||||
from utilities.api import FieldChoicesViewSet, WritableSerializerMixin
|
||||
from . import serializers
|
||||
|
||||
|
||||
#
|
||||
# Field choices
|
||||
#
|
||||
|
||||
class TenancyFieldChoicesViewSet(FieldChoicesViewSet):
|
||||
fields = ()
|
||||
|
||||
|
||||
#
|
||||
# Tenant Groups
|
||||
#
|
||||
|
Reference in New Issue
Block a user