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
Merge requests
!2256
New DatasetSet model
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New DatasetSet model
dataset-sets-reset
into
master
Overview
1
Commits
19
Pipelines
0
Changes
1
Merged
ml bonhomme
requested to merge
dataset-sets-reset
into
master
1 year ago
Overview
1
Commits
19
Pipelines
0
Changes
1
Expand
closes
#1712 (closed)
TODO:
create process dataset issue
create new API endpoints issue
Edited
1 year ago
by
ml bonhomme
0
0
Merge request reports
Viewing commit
f0543742
Prev
Next
Show latest version
1 file
+
11
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Verified
f0543742
Restore set_elements on update responses
· f0543742
Erwan Rouchet
authored
11 months ago
arkindex/training/api.py
+
11
−
0
Options
@@ -716,6 +716,17 @@ class DatasetUpdate(ACLMixin, RetrieveUpdateDestroyAPIView):
if
obj
.
state
==
DatasetState
.
Complete
:
raise
ValidationError
(
detail
=
"
This dataset is in complete state and cannot be modified anymore.
"
)
def
update
(
self
,
request
,
*
args
,
**
kwargs
):
# Do exactly the same thing as what DRF does, but without the automatic prefetch cache removal:
# https://github.com/encode/django-rest-framework/blob/2da473c8c8e024e80c13a624782f1da6272812da/rest_framework/mixins.py#L70
# This allows `set_elements` to still be returned after the update.
partial
=
kwargs
.
pop
(
"
partial
"
,
False
)
instance
=
self
.
get_object
()
serializer
=
self
.
get_serializer
(
instance
,
data
=
request
.
data
,
partial
=
partial
)
serializer
.
is_valid
(
raise_exception
=
True
)
self
.
perform_update
(
serializer
)
return
Response
(
serializer
.
data
)
def
perform_destroy
(
self
,
dataset
):
DatasetElement
.
objects
.
filter
(
set__dataset_id
=
dataset
.
id
).
delete
()
dataset
.
sets
.
all
().
delete
()
Loading