Answers for "how to redirect in django rest framework"

0

how to redirect in django rest framework

class entry_ViewSet(viewsets.ModelViewSet):
    queryset = Entry.objects.all()
    serializer_class= EntrySerializer
    permission_classes = (permissions.IsAuthenticatedOrReadOnly,IsOwnerOrReadOnly,)

    def create(self, request, *args, **kwargs):
        response = super(entry_ViewSet, self).create(request, *args, **kwargs)
        # here may be placed additional operations for
        # extracting id of the object and using reverse()
        return HttpResponseRedirect(redirect_to='https://google.com')

    def perform_create(self, serializer):
        serializer.partial = True
        serializer.save(created_by=self.request.user)
Posted by: Guest on August-17-2021

Code answers related to "how to redirect in django rest framework"

Python Answers by Framework

Browse Popular Code Answers by Language