+ for g in b.group.all():
+ a.group.add(g)
+
+ b.group.clear()
+
+ a.save()
+ if remove_duplicate:
+ b.delete()
+
+ print "Searching for empty groups and orphaned buttons:"
+ for g in ButtonGroup.objects.all():
+ if len(g.button_set.all()) == 0:
+ print "Empty group: '%s'" % g.slug
+
+ for b in Button.objects.all():
+ if len(b.group.all()) == 0:
+ print "orphan: '%s'" % b.slug