mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 11:56:25 -06:00
7848 fix the spectacular test failure
This commit is contained in:
parent
3e72d7ef07
commit
1982741e5b
@ -158,6 +158,11 @@ class NetBoxAutoSchema(AutoSchema):
|
|||||||
fields = {} if hasattr(serializer, 'child') else serializer.fields
|
fields = {} if hasattr(serializer, 'child') else serializer.fields
|
||||||
remove_fields = []
|
remove_fields = []
|
||||||
|
|
||||||
|
"""
|
||||||
|
If you get a failure here for: AttributeError: 'cached_property' object has no attribute 'items'
|
||||||
|
it is probably because you are using a viewsets.ViewSet for the API View and are defining a
|
||||||
|
serializer_class. You will also need to define a get_serializer function like GenericAPIView.
|
||||||
|
"""
|
||||||
for child_name, child in fields.items():
|
for child_name, child in fields.items():
|
||||||
# read_only fields don't need to be in writable (write only) serializers
|
# read_only fields don't need to be in writable (write only) serializers
|
||||||
if 'read_only' in dir(child) and child.read_only:
|
if 'read_only' in dir(child) and child.read_only:
|
||||||
|
@ -104,6 +104,15 @@ class BaseRQViewSet(viewsets.ViewSet):
|
|||||||
serializer = self.serializer_class(data, many=True, context={'request': request})
|
serializer = self.serializer_class(data, many=True, context={'request': request})
|
||||||
return paginator.get_paginated_response(serializer.data)
|
return paginator.get_paginated_response(serializer.data)
|
||||||
|
|
||||||
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Return the serializer instance that should be used for validating and
|
||||||
|
deserializing input, and for serializing output.
|
||||||
|
"""
|
||||||
|
serializer_class = self.get_serializer_class()
|
||||||
|
kwargs['context'] = self.get_serializer_context()
|
||||||
|
return serializer_class(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class BackgroundQueueViewSet(BaseRQViewSet):
|
class BackgroundQueueViewSet(BaseRQViewSet):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user