Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed labels order #3987

Merged
merged 5 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed Interaction handler keyboard handlers (<https://github.com/openvinotoolkit/cvat/pull/3881>)
- Points of invisible shapes are visible in autobordering (<https://github.com/openvinotoolkit/cvat/pull/3931>)
- Order of the label attributes in the object item details(<https://github.com/openvinotoolkit/cvat/pull/3945>)
- Order of label in tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/3987>)
nmanovic marked this conversation as resolved.
Show resolved Hide resolved

### Security
- TDB
Expand Down
1 change: 1 addition & 0 deletions cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class LabelSerializer(serializers.ModelSerializer):
class Meta:
model = models.Label
fields = ('id', 'name', 'color', 'attributes', 'deleted')
ordering = ['-id']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a link on documentation about the field? I can see such parameter for Django Models: https://docs.djangoproject.com/en/3.2/ref/models/options/#ordering

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or may be on the DRF source code. Because in IAM PR I deleted all such fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could not find any reference. So, moved to custom prefetching of related fields.


def validate(self, attrs):
if attrs.get('deleted') == True and attrs.get('id') is None:
Expand Down