bug fixes

This commit is contained in:
Alexander Karpov 2022-11-01 18:55:21 +03:00
parent dcac066a18
commit 13ab4ea2c2
2 changed files with 6 additions and 7 deletions

View File

@ -176,4 +176,4 @@ class ProjectSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = ["files", "created"]
fields = ["files", "slug", "created"]

View File

@ -102,7 +102,7 @@ class SmartFileUploadApi(GenericAPIView):
request.user,
)
return Response(
ListDicomSerializer(project.files.all(), many=True).data,
ProjectSerializer(project, context={"request": request}).data,
status=status.HTTP_201_CREATED,
)
@ -125,7 +125,7 @@ class AddDicomProjectApi(GenericAPIView):
slug,
)
return Response(
ListDicomSerializer(project.files.all(), many=True).data,
ProjectSerializer(project, context={"request": request}).data,
status=status.HTTP_201_CREATED,
)
@ -134,17 +134,16 @@ class DeleteDicomProjectApi(GenericAPIView):
serializer_class = SmartFileUploadSerializer
@extend_schema(
operation_id="add_dicom_to_project",
operation_id="delete_dicom_from_project",
request=None,
responses={200: ListDicomSerializer(many=True)},
)
def delete(self, request, slug, dicom_slug):
project = get_object_or_404(Project, slug=slug)
project.files.filter(slug=dicom_slug).delete()
return Response(
ListDicomSerializer(
project.files.all(), many=True, context={"request": request}
).data,
ProjectSerializer(project, context={"request": request}).data,
status=status.HTTP_200_OK,
)