Add some more custom FileField serializers

(cherry picked from commit 7b9ff27baefacc977fef7852e99d8a9bb46a062a)
This commit is contained in:
Oliver Walters 2020-05-26 20:16:10 +10:00
parent 861e30e8d6
commit 81e38eeb14
3 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,8 @@ from rest_framework import serializers
from django.db.models import Count
from InvenTree.serializers import InvenTreeModelSerializer
from InvenTree.serializers import InvenTreeAttachmentSerializerField
from company.serializers import CompanyBriefSerializer, SupplierPartSerializer
from part.serializers import PartBriefSerializer
@ -112,6 +114,8 @@ class POAttachmentSerializer(InvenTreeModelSerializer):
Serializers for the PurchaseOrderAttachment model
"""
attachment = InvenTreeAttachmentSerializerField()
class Meta:
model = PurchaseOrderAttachment
@ -255,6 +259,8 @@ class SOAttachmentSerializer(InvenTreeModelSerializer):
Serializers for the SalesOrderAttachment model
"""
attachment = InvenTreeAttachmentSerializerField()
class Meta:
model = SalesOrderAttachment

View File

@ -19,6 +19,7 @@ from django.db.models.functions import Coalesce
from InvenTree.status_codes import StockStatus, PurchaseOrderStatus, BuildStatus
from InvenTree.serializers import InvenTreeModelSerializer
from InvenTree.serializers import InvenTreeAttachmentSerializerField
class CategorySerializer(InvenTreeModelSerializer):
@ -46,6 +47,8 @@ class PartAttachmentSerializer(InvenTreeModelSerializer):
Serializer for the PartAttachment class
"""
attachment = InvenTreeAttachmentSerializerField()
class Meta:
model = PartAttachment

View File

@ -212,6 +212,8 @@ class StockItemAttachmentSerializer(InvenTreeModelSerializer):
user_detail = UserSerializerBrief(source='user', read_only=True)
attachment = InvenTreeAttachmentSerializerField()
class Meta:
model = StockItemAttachment