From a736f39f4a50c4ef4be469cddf4b7d0503495f89 Mon Sep 17 00:00:00 2001 From: Shavkatjon Odamboyev <153182519+Shavkatjon-O@users.noreply.github.com> Date: Fri, 23 Aug 2024 18:21:26 +0500 Subject: [PATCH] fix: backend api --- apps/users/serializers.py | 18 ++++++++++++++++++ apps/users/views.py | 8 ++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/users/serializers.py b/apps/users/serializers.py index c5c476e..637ca96 100644 --- a/apps/users/serializers.py +++ b/apps/users/serializers.py @@ -38,3 +38,21 @@ class Meta: "skills", "image", ) + + +class UserUpdateSerializer(serializers.ModelSerializer): + class Meta: + model = User + fields = ( + "first_name", + "last_name", + "phone_number", + "date_of_birth", + "address", + "job_title", + "department", + "education", + "employment_start_date", + "skills", + "image", + ) diff --git a/apps/users/views.py b/apps/users/views.py index 3c0e06c..bc79770 100644 --- a/apps/users/views.py +++ b/apps/users/views.py @@ -2,7 +2,11 @@ from rest_framework.permissions import AllowAny from django.contrib.auth import get_user_model -from apps.users.serializers import SignupSerializer, UserSerializer +from apps.users.serializers import ( + SignupSerializer, + UserSerializer, + UserUpdateSerializer, +) User = get_user_model() @@ -25,7 +29,7 @@ def get_object(self): class UserDetailUpdateView(generics.UpdateAPIView): queryset = User.objects.all() - serializer_class = UserSerializer + serializer_class = UserUpdateSerializer def get_object(self): return self.request.user