mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
added id to GenericObjectSerializer #14606
This commit is contained in:
@ -16,6 +16,7 @@ class GenericObjectSerializer(serializers.Serializer):
|
|||||||
"""
|
"""
|
||||||
Minimal representation of some generic object identified by ContentType and PK.
|
Minimal representation of some generic object identified by ContentType and PK.
|
||||||
"""
|
"""
|
||||||
|
id = serializers.IntegerField()
|
||||||
object_type = ContentTypeField(
|
object_type = ContentTypeField(
|
||||||
queryset=ContentType.objects.all()
|
queryset=ContentType.objects.all()
|
||||||
)
|
)
|
||||||
@ -32,6 +33,7 @@ class GenericObjectSerializer(serializers.Serializer):
|
|||||||
data = {
|
data = {
|
||||||
'object_type': content_type_identifier(ct),
|
'object_type': content_type_identifier(ct),
|
||||||
'object_id': instance.pk,
|
'object_id': instance.pk,
|
||||||
|
'id': instance.pk,
|
||||||
}
|
}
|
||||||
if 'request' in self.context:
|
if 'request' in self.context:
|
||||||
data['object'] = self.get_object(instance)
|
data['object'] = self.get_object(instance)
|
||||||
|
Reference in New Issue
Block a user