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:
voussoir 2018-05-03 18:18:13 -07:00
parent 22269af2ca
commit a0e3e037c1

View file

@ -198,6 +198,9 @@ class GroupableMixin:
if self == group:
raise ValueError('Cant join self')
if self.get_parent() == group:
return
self.leave_group(commit=False)
group.add_child(self, commit=commit)