Skip to content

Commit

Permalink
fixed dump error after moving format files (#1342)
Browse files Browse the repository at this point in the history
* fixed dump error after moving format files

* updated changelog
  • Loading branch information
azhavoro authored Apr 3, 2020
1 parent ae7dc9c commit be2ec3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- New shape is added when press ``esc`` when drawing instead of cancellation
- Fixed `FileNotFoundError` during dump after moving format files

### Security
-
Expand Down
7 changes: 6 additions & 1 deletion cvat/apps/annotation/serializers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Copyright (C) 2018 Intel Corporation
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT

from django.utils import timezone
from rest_framework import serializers

from cvat.apps.annotation import models

class AnnotationDumperSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -57,6 +59,9 @@ def create(self, validated_data):
def update(self, instance, validated_data):
dumper_names = [handler["display_name"] for handler in validated_data["annotationdumper_set"]]
loader_names = [handler["display_name"] for handler in validated_data["annotationloader_set"]]
instance.handler_file = validated_data.get('handler_file', instance.handler_file)
instance.owner = validated_data.get('owner', instance.owner)
instance.updated_date = timezone.localtime(timezone.now())

handlers_to_delete = [d for d in instance.annotationdumper_set.all() if d.display_name not in dumper_names] + \
[l for l in instance.annotationloader_set.all() if l.display_name not in loader_names]
Expand Down

0 comments on commit be2ec3a

Please sign in to comment.