Skip to content

Commit

Permalink
upload and import task post redirects to instance
Browse files Browse the repository at this point in the history
  • Loading branch information
JJFlorian committed Mar 19, 2024
1 parent c170fc6 commit 79e26fe
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from django.shortcuts import redirect
from django.urls import reverse
from django_filters.rest_framework import DjangoFilterBackend
from django.http import HttpResponseRedirect
from rest_framework import generics, permissions, status, views
from rest_framework.response import Response
from rest_framework.reverse import reverse as drf_reverse


from . import filters, mixins, models, serializers, tasks


Expand Down Expand Up @@ -137,12 +139,7 @@ def post(self, request):
)
full_url = request.build_absolute_uri(url)

return Response(
{
"message": f"Succesfully received the import taks request. Check {full_url} for the status of the import task."
},
status=status.HTTP_201_CREATED,
)
return HttpResponseRedirect(full_url)

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

Expand Down Expand Up @@ -244,12 +241,7 @@ def post(self, request):
)
full_url = request.build_absolute_uri(url)

return Response(
{
"message": f"Succesfully received the upload taks request. Check {full_url} for the status of the import task."
},
status=status.HTTP_201_CREATED,
)
return HttpResponseRedirect(full_url)

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

Expand Down

0 comments on commit 79e26fe

Please sign in to comment.