Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions label_studio/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,12 @@ def save(self, *args, update_fields=None, recalc=True, **kwargs):
if update_fields is not None:
update_fields = {'control_weights'}.union(update_fields)

# If project is published and is draft, set is_draft to False
if self.is_published and self.is_draft:
self.is_draft = False
if update_fields is not None:
update_fields = {'is_published', 'is_draft'}.union(update_fields)

super(Project, self).save(*args, update_fields=update_fields, **kwargs)

if label_config_has_changed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const CreateProject = ({ onClose }) => {
params: {
pk: project.id,
},
body: projectBody,
body: { ...projectBody, is_draft: false },
});

if (response === null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export const useDraftProject = () => {
const draft = await api.callApi("createProject", {
body: {
title: projectName,
is_draft: true,
},
});
console.log({ draft });

if (draft) setProject(draft);
}, []);
Expand Down
Loading