Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
50d94542
Commit
50d94542
authored
4 years ago
by
Bastien Abadie
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-create-classification-stale-reads' into 'master'
Fix 4 stale reads in CreateClassification Closes
#507
See merge request
!1051
parents
735b3801
a050d4a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1051
Fix 4 stale reads in CreateClassification
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/documents/serializers/ml.py
+4
-2
4 additions, 2 deletions
arkindex/documents/serializers/ml.py
with
4 additions
and
2 deletions
arkindex/documents/serializers/ml.py
+
4
−
2
View file @
50d94542
...
...
@@ -112,6 +112,8 @@ class ClassificationCreateSerializer(serializers.ModelSerializer):
"""
Serializer to create a single classification, defaulting to manual
"""
element
=
serializers
.
PrimaryKeyRelatedField
(
queryset
=
Element
.
objects
.
using
(
'
default
'
))
ml_class
=
serializers
.
PrimaryKeyRelatedField
(
queryset
=
MLClass
.
objects
.
using
(
'
default
'
))
worker_version
=
serializers
.
PrimaryKeyRelatedField
(
queryset
=
WorkerVersion
.
objects
.
all
(),
default
=
None
)
confidence
=
serializers
.
FloatField
(
min_value
=
0
,
...
...
@@ -143,11 +145,11 @@ class ClassificationCreateSerializer(serializers.ModelSerializer):
read_only_fields
=
(
'
id
'
,
'
state
'
)
validators
=
[
UniqueTogetherValidator
(
queryset
=
Classification
.
objects
.
filter
(
worker_version__isnull
=
False
,
source_id__isnull
=
True
),
queryset
=
Classification
.
objects
.
using
(
'
default
'
).
filter
(
worker_version__isnull
=
False
,
source_id__isnull
=
True
),
fields
=
[
'
element
'
,
'
worker_version
'
,
'
ml_class
'
]
),
UniqueTogetherValidator
(
queryset
=
Classification
.
objects
.
filter
(
worker_version__isnull
=
True
,
source_id__isnull
=
True
),
queryset
=
Classification
.
objects
.
using
(
'
default
'
).
filter
(
worker_version__isnull
=
True
,
source_id__isnull
=
True
),
fields
=
[
'
element
'
,
'
ml_class
'
]
)
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment