File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
netbox_custom_objects/api Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11from django .http import Http404
2+ from drf_spectacular .utils import extend_schema_view , extend_schema
23from rest_framework .routers import APIRootView
34from rest_framework .viewsets import ModelViewSet
45
@@ -17,6 +18,18 @@ class CustomObjectTypeViewSet(ModelViewSet):
1718 serializer_class = serializers .CustomObjectTypeSerializer
1819
1920
21+ # TODO: Need to remove this for now, check if work-around in the future.
22+ # There is a catch-22 spectacular get the queryset and serializer class without
23+ # params at startup. The suggested workaround is to return the model empty
24+ # queryset, but we can't get the model without params at startup.
25+ @extend_schema_view (
26+ list = extend_schema (exclude = True ),
27+ retrieve = extend_schema (exclude = True ),
28+ create = extend_schema (exclude = True ),
29+ update = extend_schema (exclude = True ),
30+ partial_update = extend_schema (exclude = True ),
31+ destroy = extend_schema (exclude = True )
32+ )
2033class CustomObjectViewSet (ModelViewSet ):
2134 serializer_class = serializers .CustomObjectSerializer
2235 model = None
You can’t perform that action at this time.
0 commit comments