Commit 498f0503 authored by Gladys Forte's avatar Gladys Forte

added serializer data to attachment

parent 8dda9d48
...@@ -36,12 +36,15 @@ class ChangeRequestFormAttachmentsFileUploadSerializer( ...@@ -36,12 +36,15 @@ class ChangeRequestFormAttachmentsFileUploadSerializer(
class Meta: class Meta:
model = models.ChangeRequestFormAttachments model = models.ChangeRequestFormAttachments
fields = ( fields = (
'id',
'code',
'attachment_type', 'attachment_type',
'attachment_name', 'attachment_name',
'file_name', 'file_name',
'description', 'description',
'file_upload', 'file_upload',
'uploaded_by', 'uploaded_by',
'form_code' 'form_code',
'created'
) )
# read_only_fields = ['created', 'code'] read_only_fields = ['id,', 'created', 'code']
\ No newline at end of file \ No newline at end of file
...@@ -1294,11 +1294,18 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet): ...@@ -1294,11 +1294,18 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
id_number id_number
) )
self.queryset = models.ChangeRequestFormAttachments.objects.filter(
form_code=form_code
)
self.serializer_class = ChangeRequestFormAttachmentsFileUploadSerializer
serializer = self.get_serializer(self.queryset, many=True)
message = status_message_response( message = status_message_response(
200, 'success', 200, 'success',
'Attachments successfully updated!', 'Attachments successfully updated!',
'' serializer.data
) )
return Response(message, status=status.HTTP_200_OK) return Response(message, status=status.HTTP_200_OK)
......
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