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
dd784733
Commit
dd784733
authored
1 year ago
by
Valentin Rigal
Committed by
Erwan Rouchet
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Prevent duplication of dataset elements
parent
2001966b
No related branches found
No related tags found
1 merge request
!2276
Dataset unique elements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/training/serializers.py
+12
-1
12 additions, 1 deletion
arkindex/training/serializers.py
with
12 additions
and
1 deletion
arkindex/training/serializers.py
+
12
−
1
View file @
dd784733
...
...
@@ -714,7 +714,18 @@ class DatasetElementSerializer(serializers.ModelSerializer):
def
validate
(
self
,
data
):
data
=
super
().
validate
(
data
)
data
.
pop
(
"
dataset
"
)
dataset
=
data
.
pop
(
"
dataset
"
)
if
dataset
.
unique_elements
and
(
set
:
=
(
dataset
.
sets
.
filter
(
set_elements__element_id
=
data
[
"
element_id
"
])
.
values_list
(
"
name
"
,
flat
=
True
)
.
first
()
)
):
raise
ValidationError
({
"
element_id
"
:
[
f
"
The dataset prevent duplication and this element is already present in set
{
set
}
.
"
]})
return
data
...
...
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