diff --git a/CHANGELOG.md b/CHANGELOG.md index 4888e4dc8f99..b0472d8a7478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added information to export CVAT_HOST when performing local installation for accessing over network () - Fixed possible color collisions in the generated colormap () - Original pdf file is deleted when using share () +- Order in an annotation file() - Fixed task data upload progressbar () ### Security diff --git a/cvat/apps/dataset_manager/bindings.py b/cvat/apps/dataset_manager/bindings.py index 64dc1bb55f85..7320f6547630 100644 --- a/cvat/apps/dataset_manager/bindings.py +++ b/cvat/apps/dataset_manager/bindings.py @@ -1,5 +1,5 @@ -# Copyright (C) 2019-2020 Intel Corporation +# Copyright (C) 2019-2021 Intel Corporation # # SPDX-License-Identifier: MIT diff --git a/cvat/apps/dataset_manager/task.py b/cvat/apps/dataset_manager/task.py index da692d4ffa49..a5ea8310c52a 100644 --- a/cvat/apps/dataset_manager/task.py +++ b/cvat/apps/dataset_manager/task.py @@ -7,6 +7,7 @@ from enum import Enum from django.db import transaction +from django.db.models.query import Prefetch from django.utils import timezone from cvat.apps.engine import models, serializers @@ -547,7 +548,9 @@ def import_annotations(self, src_file, importer): class TaskAnnotation: def __init__(self, pk): - self.db_task = models.Task.objects.prefetch_related("data__images").get(id=pk) + self.db_task = models.Task.objects.prefetch_related( + Prefetch('data__images', queryset=models.Image.objects.order_by('frame')) + ).get(id=pk) # Postgres doesn't guarantee an order by default without explicit order_by self.db_jobs = models.Job.objects.select_related("segment").filter(segment__task_id=pk).order_by('id')