Bail out of join_group early if already immediate parent.
I'd rather make the extra select than a delete and reinsert.
This commit is contained in:
parent
22269af2ca
commit
a0e3e037c1
1 changed files with 3 additions and 0 deletions
|
@ -198,6 +198,9 @@ class GroupableMixin:
|
||||||
if self == group:
|
if self == group:
|
||||||
raise ValueError('Cant join self')
|
raise ValueError('Cant join self')
|
||||||
|
|
||||||
|
if self.get_parent() == group:
|
||||||
|
return
|
||||||
|
|
||||||
self.leave_group(commit=False)
|
self.leave_group(commit=False)
|
||||||
group.add_child(self, commit=commit)
|
group.add_child(self, commit=commit)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue