* Fix order

* Update header

* Update changelog

* Add Prefetch

Co-authored-by: Nikita Manovich <nikita.manovich@intel.com>
main
Maria Khrustaleva 4 years ago committed by GitHub
parent 59f0b3bb47
commit 297a9cccb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 (<https://github.com/openvinotoolkit/cvat/pull/4014>) - Added information to export CVAT_HOST when performing local installation for accessing over network (<https://github.com/openvinotoolkit/cvat/pull/4014>)
- Fixed possible color collisions in the generated colormap (<https://github.com/openvinotoolkit/cvat/pull/4007>) - Fixed possible color collisions in the generated colormap (<https://github.com/openvinotoolkit/cvat/pull/4007>)
- Original pdf file is deleted when using share (<https://github.com/openvinotoolkit/cvat/pull/3967>) - Original pdf file is deleted when using share (<https://github.com/openvinotoolkit/cvat/pull/3967>)
- Order in an annotation file(<https://github.com/openvinotoolkit/cvat/pull/4087>)
- Fixed task data upload progressbar (<https://github.com/openvinotoolkit/cvat/pull/4134>) - Fixed task data upload progressbar (<https://github.com/openvinotoolkit/cvat/pull/4134>)
### Security ### Security

@ -1,5 +1,5 @@
# Copyright (C) 2019-2020 Intel Corporation # Copyright (C) 2019-2021 Intel Corporation
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT

@ -7,6 +7,7 @@ from collections import OrderedDict
from enum import Enum from enum import Enum
from django.db import transaction from django.db import transaction
from django.db.models.query import Prefetch
from django.utils import timezone from django.utils import timezone
from cvat.apps.engine import models, serializers from cvat.apps.engine import models, serializers
@ -547,7 +548,9 @@ class JobAnnotation:
class TaskAnnotation: class TaskAnnotation:
def __init__(self, pk): 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 # 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') self.db_jobs = models.Job.objects.select_related("segment").filter(segment__task_id=pk).order_by('id')

Loading…
Cancel
Save