2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

Add new attechment functionality to new models

- Giving the ol' refactor tractor a fresh coat of paint
This commit is contained in:
Oliver Walters
2020-05-12 21:40:42 +10:00
parent 2369b40bbf
commit 366d4b2143
10 changed files with 70 additions and 46 deletions

View File

@ -25,6 +25,7 @@ from . import serializers as part_serializers
from InvenTree.views import TreeSerializer
from InvenTree.helpers import str2bool, isNull
from InvenTree.api import AttachmentMixin
class PartCategoryTree(TreeSerializer):
@ -106,7 +107,7 @@ class CategoryDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = PartCategory.objects.all()
class PartAttachmentList(generics.ListCreateAPIView):
class PartAttachmentList(generics.ListCreateAPIView, AttachmentMixin):
"""
API endpoint for listing (and creating) a PartAttachment (file upload).
"""
@ -114,14 +115,6 @@ class PartAttachmentList(generics.ListCreateAPIView):
queryset = PartAttachment.objects.all()
serializer_class = part_serializers.PartAttachmentSerializer
permission_classes = [permissions.IsAuthenticated]
filter_backends = [
DjangoFilterBackend,
filters.OrderingFilter,
filters.SearchFilter,
]
filter_fields = [
'part',
]