mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-12 18:48:17 -06:00
14606 add id to GenericObjectSerializer
This commit is contained in:
parent
3b767fd7d3
commit
abf32d7587
@ -2005,10 +2005,12 @@ class CableTest(APIViewTestCases.APIViewTestCase):
|
|||||||
cls.create_data = [
|
cls.create_data = [
|
||||||
{
|
{
|
||||||
'a_terminations': [{
|
'a_terminations': [{
|
||||||
|
'id': interfaces[4].pk,
|
||||||
'object_type': 'dcim.interface',
|
'object_type': 'dcim.interface',
|
||||||
'object_id': interfaces[4].pk,
|
'object_id': interfaces[4].pk,
|
||||||
}],
|
}],
|
||||||
'b_terminations': [{
|
'b_terminations': [{
|
||||||
|
'id': interfaces[14].pk,
|
||||||
'object_type': 'dcim.interface',
|
'object_type': 'dcim.interface',
|
||||||
'object_id': interfaces[14].pk,
|
'object_id': interfaces[14].pk,
|
||||||
}],
|
}],
|
||||||
@ -2016,10 +2018,12 @@ class CableTest(APIViewTestCases.APIViewTestCase):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'a_terminations': [{
|
'a_terminations': [{
|
||||||
|
'id': interfaces[5].pk,
|
||||||
'object_type': 'dcim.interface',
|
'object_type': 'dcim.interface',
|
||||||
'object_id': interfaces[5].pk,
|
'object_id': interfaces[5].pk,
|
||||||
}],
|
}],
|
||||||
'b_terminations': [{
|
'b_terminations': [{
|
||||||
|
'id': interfaces[15].pk,
|
||||||
'object_type': 'dcim.interface',
|
'object_type': 'dcim.interface',
|
||||||
'object_id': interfaces[15].pk,
|
'object_id': interfaces[15].pk,
|
||||||
}],
|
}],
|
||||||
@ -2027,10 +2031,12 @@ class CableTest(APIViewTestCases.APIViewTestCase):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'a_terminations': [{
|
'a_terminations': [{
|
||||||
|
'id': interfaces[6].pk,
|
||||||
'object_type': 'dcim.interface',
|
'object_type': 'dcim.interface',
|
||||||
'object_id': interfaces[6].pk,
|
'object_id': interfaces[6].pk,
|
||||||
}],
|
}],
|
||||||
'b_terminations': [{
|
'b_terminations': [{
|
||||||
|
'id': interfaces[16].pk,
|
||||||
'object_type': 'dcim.interface',
|
'object_type': 'dcim.interface',
|
||||||
'object_id': interfaces[16].pk,
|
'object_id': interfaces[16].pk,
|
||||||
}],
|
}],
|
||||||
|
@ -16,7 +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()
|
id = serializers.IntegerField(read_only=True, required=False)
|
||||||
object_type = ContentTypeField(
|
object_type = ContentTypeField(
|
||||||
queryset=ContentType.objects.all()
|
queryset=ContentType.objects.all()
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user