fix: project update for identifier (#604)
This commit is contained in:
parent
3a599b6436
commit
5aad20e7ed
1 changed files with 6 additions and 3 deletions
|
|
@ -58,12 +58,15 @@ class ProjectSerializer(BaseSerializer):
|
||||||
project_identifier = ProjectIdentifier.objects.filter(
|
project_identifier = ProjectIdentifier.objects.filter(
|
||||||
name=identifier, workspace_id=instance.workspace_id
|
name=identifier, workspace_id=instance.workspace_id
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if project_identifier is None:
|
if project_identifier is None:
|
||||||
project = super().update(instance, validated_data)
|
project = super().update(instance, validated_data)
|
||||||
_ = ProjectIdentifier.objects.update(name=identifier, project=project)
|
project_identifier = ProjectIdentifier.objects.filter(
|
||||||
|
project=project
|
||||||
|
).first()
|
||||||
|
if project_identifier is not None:
|
||||||
|
project_identifier.name = identifier
|
||||||
|
project_identifier.save()
|
||||||
return project
|
return project
|
||||||
|
|
||||||
# If found check if the project_id to be updated and identifier project id is same
|
# If found check if the project_id to be updated and identifier project id is same
|
||||||
if project_identifier.project_id == instance.id:
|
if project_identifier.project_id == instance.id:
|
||||||
# If same pass update
|
# If same pass update
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue