1👍
✅
You could query the groups count before and after, to see if anything changed:
...
num_groups = parent.groups.count()
parent.groups.add(*groups)
if parent.groups.count() > num_groups:
# Something was added
parent.save()
...
Source:stackexchange.com