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

Ensure user gets saved when uploading attachment via API

This commit is contained in:
Oliver Walters
2020-05-12 21:11:38 +10:00
parent 5d716d0cdd
commit 2369b40bbf
2 changed files with 10 additions and 11 deletions

View File

@ -663,6 +663,12 @@ class StockAttachmentList(generics.ListCreateAPIView):
'stock_item',
]
def perform_create(self, serializer):
attachment = serializer.save()
attachment.user = self.request.user
attachment.save()
class StockTrackingList(generics.ListCreateAPIView):
""" API endpoint for list view of StockItemTracking objects.