feat: change user_update api response, and add the basic and session auth to rest framework config file #36

Merged
xoliqberdiyev merged 1 commits from behruz into main 2026-04-02 12:08:36 +00:00
2 changed files with 7 additions and 3 deletions

View File

@@ -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",

View File

@@ -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")