Commit bb851df9 authored by John Red Medrano's avatar John Red Medrano

refactor upload

parent b1393cf1
...@@ -44,11 +44,15 @@ class MasterAttachmentViewSet(viewsets.ModelViewSet): ...@@ -44,11 +44,15 @@ class MasterAttachmentViewSet(viewsets.ModelViewSet):
for instance in self.request.data.getlist(key): for instance in self.request.data.getlist(key):
body = {} body = {}
data = MasterAttachment.objects.create(url=instance) data = MasterAttachment.objects.create(
url=instance,
attch_ref=key
)
file_name = str(data.url).split('/') file_name = str(data.url).split('/')
body['id'] = data.id body['id'] = data.id
body['file_name'] = instance.name body['file_name'] = instance.name
body['attch_ref'] = key
attachments.append(body) attachments.append(body)
return Response( return Response(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment