Add part detail filter to PartRelated serializer

This commit is contained in:
Oliver 2021-11-25 14:42:44 +11:00
parent 4704845a7b
commit 88df774aef

View File

@ -225,20 +225,6 @@ class PartBriefSerializer(InvenTreeModelSerializer):
]
class PartRelationSerializer(InvenTreeModelSerializer):
"""
Serializer for a PartRelated model
"""
class Meta:
model = PartRelated
fields = [
'pk',
'part_1',
'part_2',
]
class PartSerializer(InvenTreeModelSerializer):
""" Serializer for complete detail information of a part.
Used when displaying all details of a single component.
@ -402,6 +388,25 @@ class PartSerializer(InvenTreeModelSerializer):
]
class PartRelationSerializer(InvenTreeModelSerializer):
"""
Serializer for a PartRelated model
"""
part_1_detail = PartSerializer(source='part_1', read_only=True, many=False)
part_2_detail = PartSerializer(source='part_1', read_only=True, many=False)
class Meta:
model = PartRelated
fields = [
'pk',
'part_1',
'part_1_detail',
'part_2',
'part_2_detail',
]
class PartStarSerializer(InvenTreeModelSerializer):
""" Serializer for a PartStar object """