Skip to content

Commit

Permalink
Sync grouping node id in more cases re #11613
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Nov 14, 2024
1 parent a9b2f32 commit 3d76882
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions arches/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,18 +915,21 @@ def __init__(self, *args, **kwargs):
def clean(self):
if not self.alias:
Graph.objects.get(pk=self.graph_id).create_node_alias(self)
if not self.grouping_node_id:
self.grouping_node_id = self.nodegroup_id
self.grouping_node_id = self.nodegroup_id
if self.pk == self.source_identifier_id:
self.source_identifier_id = None

def save(self, **kwargs):
if not self.alias or not self.grouping_node_id:
self.clean()
if not self.alias:
add_to_update_fields(kwargs, "alias")
add_to_update_fields(kwargs, "hascustomalias")
if self.grouping_node_id != self.nodegroup_id:
add_to_update_fields(kwargs, "grouping_node_id")
if self.pk == self.source_identifier_id:
self.source_identifier_id = None
add_to_update_fields(kwargs, "source_identifier_id")

self.clean()

super(Node, self).save()

class Meta:
Expand Down

0 comments on commit 3d76882

Please sign in to comment.