structure and basic setup
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
from rest_framework.serializers import ModelSerializer, ValidatedModelSerializer
|
||||
|
||||
from dcim.models import DeviceRole
|
||||
|
||||
class PreDeviceRoleSerializer(ValidatedModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = DeviceRole
|
||||
fields = ('id', 'name', 'slug', 'color', 'vm_role', 'description')
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from rest_framework import routers
|
||||
|
||||
from .views import PreSelectDeviceRolesViewSet
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
#router.register('device_roles', AnimalViewSet)
|
||||
#router.register('sites', AnimalViewSet)
|
||||
#router.register('search', AnimalViewSet)
|
||||
#router.register('save_coords', AnimalViewSet)
|
||||
router.register('preselectdeviceroles', PreSelectDeviceRolesViewSet)
|
||||
|
||||
urlpatterns = router.urls
|
||||
@@ -0,0 +1,9 @@
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
|
||||
from .serializers import PreDeviceRoleSerializer
|
||||
|
||||
from dcim.models import DeviceRole
|
||||
|
||||
class PreSelectDeviceRolesViewSet(ModelViewSet):
|
||||
queryset = DeviceRole.objects.all()
|
||||
serializer_class = PreDeviceRoleSerializer
|
||||
|
||||
Reference in New Issue
Block a user