@@ -148,23 +148,20 @@ def patch(self, request, uid):
148148 request_is_staff = data .get ("is_staff" )
149149 request_is_superuser = data .get ("is_superuser" )
150150
151- if request_is_active != None :
152- if request_is_active != user .is_active :
153- return Response ({
154- "detail" : "You have no permission to change this user"
155- }, status = status .HTTP_403_FORBIDDEN )
156-
157- if request_is_staff != None :
158- if request_is_staff != user .is_active :
159- return Response ({
160- "detail" : "You have no permission to change this user"
161- }, status = status .HTTP_403_FORBIDDEN )
162-
163- if request_is_superuser != None :
164- if request_is_superuser != user .is_active :
165- return Response ({
166- "detail" : "You have no permission to change this user"
167- }, status = status .HTTP_403_FORBIDDEN )
151+ if request_is_active != None and request_is_active != user .is_active :
152+ return Response ({
153+ "detail" : "You have no permission to change this user"
154+ }, status = status .HTTP_403_FORBIDDEN )
155+
156+ if request_is_staff != None and request_is_staff != user .is_active :
157+ return Response ({
158+ "detail" : "You have no permission to change this user"
159+ }, status = status .HTTP_403_FORBIDDEN )
160+
161+ if request_is_superuser != None and request_is_superuser != user .is_superuser :
162+ return Response ({
163+ "detail" : "You have no permission to change this user"
164+ }, status = status .HTTP_403_FORBIDDEN )
168165
169166 us = AccountSerializer (user , data = data , partial = True )
170167 us .is_valid (raise_exception = True )
0 commit comments