mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #8077: Fix exception when attaching image to location, circuit, or power panel
This commit is contained in:
parent
b6ff55309e
commit
b92e34556f
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
* [#7674](https://github.com/netbox-community/netbox/issues/7674) - Fix inadvertent application of device type context to virtual machines
|
* [#7674](https://github.com/netbox-community/netbox/issues/7674) - Fix inadvertent application of device type context to virtual machines
|
||||||
* [#8074](https://github.com/netbox-community/netbox/issues/8074) - Ordering VMs by name should reference naturalized value
|
* [#8074](https://github.com/netbox-community/netbox/issues/8074) - Ordering VMs by name should reference naturalized value
|
||||||
|
* [#8077](https://github.com/netbox-community/netbox/issues/8077) - Fix exception when attaching image to location, circuit, or power panel
|
||||||
* [#8078](https://github.com/netbox-community/netbox/issues/8078) - Add missing wireless models to `lsmodels()` in `nbshell`
|
* [#8078](https://github.com/netbox-community/netbox/issues/8078) - Add missing wireless models to `lsmodels()` in `nbshell`
|
||||||
* [#8079](https://github.com/netbox-community/netbox/issues/8079) - Fix validation of LLDP neighbors when connected device has an asset tag
|
* [#8079](https://github.com/netbox-community/netbox/issues/8079) - Fix validation of LLDP neighbors when connected device has an asset tag
|
||||||
|
|
||||||
|
@ -170,17 +170,7 @@ class ImageAttachmentSerializer(ValidatedModelSerializer):
|
|||||||
|
|
||||||
@swagger_serializer_method(serializer_or_field=serializers.DictField)
|
@swagger_serializer_method(serializer_or_field=serializers.DictField)
|
||||||
def get_parent(self, obj):
|
def get_parent(self, obj):
|
||||||
|
serializer = get_serializer_for_model(obj.parent, prefix='Nested')
|
||||||
# Static mapping of models to their nested serializers
|
|
||||||
if isinstance(obj.parent, Device):
|
|
||||||
serializer = NestedDeviceSerializer
|
|
||||||
elif isinstance(obj.parent, Rack):
|
|
||||||
serializer = NestedRackSerializer
|
|
||||||
elif isinstance(obj.parent, Site):
|
|
||||||
serializer = NestedSiteSerializer
|
|
||||||
else:
|
|
||||||
raise Exception("Unexpected type of parent object for ImageAttachment")
|
|
||||||
|
|
||||||
return serializer(obj.parent, context={'request': self.context['request']}).data
|
return serializer(obj.parent, context={'request': self.context['request']}).data
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user