diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index 4d717d157ea0..4032636e38d3 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -569,8 +569,11 @@ def perform_update(self, serializer): project_id = instance.project_id updated_instance = serializer.save() if project_id != updated_instance.project_id: - Project.objects.get(id=project_id).save() - Project.objects.get(id=updated_instance.project_id).save() + if project_id is not None: + Project.objects.get(id=project_id).save() + if updated_instance.project_id is not None: + Project.objects.get(id=updated_instance.project_id).save() + def perform_create(self, serializer): owner = self.request.data.get('owner', None)