|
@@ -107,7 +107,7 @@ class Project(NamedBaseModel):
|
|
|
return self.collections.filter_by(reference=reference).one_or_none()
|
|
|
|
|
|
def create_label(self, name: str, reference: str = None,
|
|
|
- parent: T.Union[Label, int, str] = None, commit: bool = True) -> T.Tuple[T.Optional[Label], bool]:
|
|
|
+ parent_id: T.Union[Label, int, str] = None, commit: bool = True) -> T.Tuple[T.Optional[Label], bool]:
|
|
|
"""
|
|
|
create a label for this project. If there is already a label with the same reference
|
|
|
in the database its name is updated.
|
|
@@ -118,16 +118,16 @@ class Project(NamedBaseModel):
|
|
|
:return: created or edited label, insert
|
|
|
"""
|
|
|
|
|
|
- if isinstance(parent, str):
|
|
|
- parent = self.label_by_reference(parent)
|
|
|
+ if isinstance(parent_id, str):
|
|
|
+ parent_id = self.label_by_reference(parent_id)
|
|
|
|
|
|
- if isinstance(parent, Label):
|
|
|
- parent = parent.id
|
|
|
+ if isinstance(parent_id, Label):
|
|
|
+ parent_id = parent_id.id
|
|
|
|
|
|
label, is_new = Label.get_or_create(project=self, reference=reference)
|
|
|
|
|
|
label.name = name
|
|
|
- label.set_parent(parent, commit=False)
|
|
|
+ label.set_parent(parent_id, commit=False)
|
|
|
|
|
|
if commit:
|
|
|
self.commit()
|