Skip to content

Commit

Permalink
Update project only if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jaesuny committed Nov 2, 2021
1 parent ed1d24e commit fea4ba5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fea4ba5

Please sign in to comment.