From 0dbd24612065a7935791520d7cf34e2a02f45b17 Mon Sep 17 00:00:00 2001 From: xoliqberdiyev Date: Thu, 2 Apr 2026 17:07:56 +0500 Subject: [PATCH] feat: change user_update api response, and add the basic and session auth to rest framework config file --- config/conf/rest_framework.py | 6 +++++- core/apps/accounts/views/auth.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/conf/rest_framework.py b/config/conf/rest_framework.py index fbec6fe..507401e 100644 --- a/config/conf/rest_framework.py +++ b/config/conf/rest_framework.py @@ -1,7 +1,11 @@ from typing import Any, Union REST_FRAMEWORK: Union[Any] = { - "DEFAULT_AUTHENTICATION_CLASSES": ("rest_framework_simplejwt.authentication.JWTAuthentication",), + "DEFAULT_AUTHENTICATION_CLASSES": ( + "rest_framework.authentication.SessionAuthentication", + "rest_framework.authentication.BaseAuthentication", + "rest_framework_simplejwt.authentication.JWTAuthentication", + ), "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema", "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"], "DEFAULT_PAGINATION_CLASS": "django_core.paginations.CustomPagination", diff --git a/core/apps/accounts/views/auth.py b/core/apps/accounts/views/auth.py index 984211b..f8b599c 100644 --- a/core/apps/accounts/views/auth.py +++ b/core/apps/accounts/views/auth.py @@ -183,8 +183,8 @@ class MeView(BaseViewSetMixin, GenericViewSet, UserService): def user_update(self, request): ser = self.get_serializer(instance=request.user, data=request.data, partial=True) ser.is_valid(raise_exception=True) - ser.save() - return Response({"detail": _("Malumotlar yangilandi")}) + data = ser.save() + return Response(UserSerializer(data).data) @extend_schema(tags=["change-password"], description="Parolni o'zgartirish uchun")