def _update_self(self, request, user_id=None): """ Updates itself """ user = User.objects.get(pk=user_id) data = request.data partial = False if 'profile' in data: if user.profile != data['profile']: raise PermissionDenied else: partial = True if 'is_active' in data: if data['is_active'] == str(False): raise PermissionDenied else: partial = True return ModelViewSet.update(self, request, user_id, partial=partial)
def update(self, request, *args, **kwargs): return ModelViewSet.update(self, request, *args, partial=True, **kwargs)
def update(self, request, *args, **kwargs): return ModelViewSet.update(self, request, *args, **kwargs)
def update(self, request, pk=None): product = self.get_object() data = request.data return ModelViewSet.update(self, request, pk)
def update(self, request: Request, *args, **kwargs): inst = self.get_object() self.secure_update(request, inst) return ModelViewSet.update(self, request, *args, **kwargs)