From 6e8baca8c9423edf4ff172238480654f5088b2cb Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Fri, 7 Aug 2015 22:01:16 +0800 Subject: [PATCH] =?UTF-8?q?django=20rest=20framework=203.2=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E4=BD=BF=E7=94=A8=20request.data=E4=BB=A3=E6=9B=BF=20?= =?UTF-8?q?request.DATA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account/views.py | 12 ++++++------ announcement/views.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/account/views.py b/account/views.py index ec29f970..e1287829 100644 --- a/account/views.py +++ b/account/views.py @@ -19,7 +19,7 @@ class UserLoginAPIView(APIView): --- request_serializer: UserLoginSerializer """ - serializer = UserLoginSerializer(data=request.DATA) + serializer = UserLoginSerializer(data=request.data) if serializer.is_valid(): data = serializer.data user = auth.authenticate(username=data["username"], password=data["password"]) @@ -40,7 +40,7 @@ class UserRegisterAPIView(APIView): --- request_serializer: UserRegisterSerializer """ - serializer = UserRegisterSerializer(data=request.DATA) + serializer = UserRegisterSerializer(data=request.data) if serializer.is_valid(): data = serializer.data try: @@ -68,7 +68,7 @@ class UserChangePasswordAPIView(APIView): --- request_serializer: UserChangePasswordSerializer """ - serializer = UserChangePasswordSerializer(data=request.DATA) + serializer = UserChangePasswordSerializer(data=request.data) if serializer.is_valid(): data = serializer.data user = auth.authenticate(username=data["username"], password=data["old_password"]) @@ -89,7 +89,7 @@ class UsernameCheckAPIView(APIView): --- request_serializer: UsernameCheckSerializer """ - serializer = UsernameCheckSerializer(data=request.DATA) + serializer = UsernameCheckSerializer(data=request.data) if serializer.is_valid(): try: User.objects.get(username=serializer.data["username"]) @@ -107,7 +107,7 @@ class EmailCheckAPIView(APIView): --- request_serializer: EmailCheckSerializer """ - serializer = EmailCheckSerializer(data=request.DATA) + serializer = EmailCheckSerializer(data=request.data) if serializer.is_valid(): try: User.objects.get(email=serializer.data["email"]) @@ -148,7 +148,7 @@ class UserAdminAPIView(APIView): request_serializer: EditUserSerializer response_serializer: UserSerializer """ - serializer = EditUserSerializer(data=request.DATA) + serializer = EditUserSerializer(data=request.data) if serializer.is_valid(): data = serializer.data try: diff --git a/announcement/views.py b/announcement/views.py index a96b1f1d..654d91a3 100644 --- a/announcement/views.py +++ b/announcement/views.py @@ -17,7 +17,7 @@ class AnnouncementAdminAPIView(APIView): --- request_serializer: CreateAnnouncementSerializer """ - serializer = CreateAnnouncementSerializer(data=request.DATA) + serializer = CreateAnnouncementSerializer(data=request.data) if serializer.is_valid(): data = serializer.data Announcement.objects.create(title=data["title"], @@ -34,7 +34,7 @@ class AnnouncementAdminAPIView(APIView): request_serializer: EditAnnouncementSerializer response_serializer: AnnouncementSerializer """ - serializer = EditAnnouncementSerializer(data=request.DATA) + serializer = EditAnnouncementSerializer(data=request.data) if serializer.is_valid(): data = serializer.data try: