Supports profile updates

only background for now, but hey.
This commit is contained in:
2025-05-22 22:53:39 +02:00
parent a54f8947bb
commit e7cc031588
3 changed files with 20 additions and 6 deletions
+9 -1
View File
@@ -2,7 +2,7 @@ from pickle import BUILD
from playlist import serializers
from rest_framework.views import APIView
from rest_framework.response import Response
from playlist.serializers import ProfileSerializer, BackgroundSerializer
from playlist.serializers import ProfileSerializer, ProfileUpdateSerializer, BackgroundSerializer
from playlist.models import Profile, Background
class ProfileDetailView(APIView):
@@ -11,6 +11,14 @@ class ProfileDetailView(APIView):
serializer = ProfileSerializer(profile)
return Response(serializer.data)
def put(self, request, id):
profile = Profile.objects.get(pk=id)
serializer = ProfileUpdateSerializer(profile, data=request.data)
serializer.is_valid()
serializer.save()
return Response(serializer.data)
#return Response()
class BackgroundListView(APIView):
def get(self, request):
backgrounds = Background.objects.all()