From 5e313c653026585d8e93d75b5398f51bd69cc680 Mon Sep 17 00:00:00 2001 From: George J Padayatti Date: Sun, 7 Apr 2024 07:22:16 +0530 Subject: [PATCH] Fix #60: Data source update endpoint is not working Signed-off-by: George J Padayatti --- config/views.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/config/views.py b/config/views.py index ef77e2e..1bbba62 100644 --- a/config/views.py +++ b/config/views.py @@ -1,23 +1,24 @@ import os -from django.http import JsonResponse, HttpResponse -from .serializers import ( - DataSourceSerializer, - VerificationSerializer, - VerificationTemplateSerializer, -) -from .models import DataSource, Verification, ImageModel, VerificationTemplate -from rest_framework.views import APIView + +import requests +from django.http import HttpResponse, JsonResponse +from rest_auth.serializers import PasswordChangeSerializer +from rest_auth.views import sensitive_post_parameters_m +from rest_framework import permissions, status from rest_framework.generics import GenericAPIView -from rest_framework import status, permissions from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response -from rest_auth.serializers import PasswordChangeSerializer -from rest_auth.views import sensitive_post_parameters_m -from onboard.serializers import DataspaceUserSerializer +from rest_framework.views import APIView + from connection.models import Connection -from dataspace_backend.settings import DATA_MARKETPLACE_DW_URL, DATA_MARKETPLACE_APIKEY -import requests from dataspace_backend import settings +from dataspace_backend.settings import (DATA_MARKETPLACE_APIKEY, + DATA_MARKETPLACE_DW_URL) +from onboard.serializers import DataspaceUserSerializer + +from .models import DataSource, ImageModel, Verification, VerificationTemplate +from .serializers import (DataSourceSerializer, VerificationSerializer, + VerificationTemplateSerializer) # Create your views here. @@ -157,7 +158,7 @@ def get(self, request): return JsonResponse(response_data) def put(self, request): - data = request.data.get("organisation", {}) + data = request.data.get("dataSource", {}) # Get the DataSource instance associated with the current user try: @@ -523,4 +524,4 @@ def post(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) serializer.save() - return Response({"detail": "New password has been saved."}) \ No newline at end of file + return Response({"detail": "New password has been saved."}) return Response({"detail": "New password has been saved."}) \ No newline at end of file