2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 02:25:38 +00:00

Add ability to add part file attachments via the API

This commit is contained in:
Oliver Walters
2020-05-11 23:25:55 +10:00
parent f71bfb5700
commit f36c5137dd
2 changed files with 65 additions and 33 deletions

View File

@ -9,6 +9,7 @@ from .models import Part, PartStar
from .models import PartCategory
from .models import BomItem
from .models import PartParameter, PartParameterTemplate
from .models import PartAttachment
from decimal import Decimal
@ -39,6 +40,22 @@ class CategorySerializer(InvenTreeModelSerializer):
]
class PartAttachmentSerializer(InvenTreeModelSerializer):
"""
Serializer for the PartAttachment class
"""
class Meta:
model = PartAttachment
fields = [
'pk',
'part',
'attachment',
'comment'
]
class PartThumbSerializer(serializers.Serializer):
"""
Serializer for the 'image' field of the Part model.