(self, group_ids)
return bool(touched)
:returns: True if groups were updated
:returns: True if groups were updated
: returns : True if groups were updated
def set_groups(self, group_ids):
        """
        :returns: True if groups were updated
        """
        from corehq.apps.groups.models import Group
        desired = set(group_ids)
        current = set(self.get_group_ids())
        touched = []
        for to_add in desired - current:
            group = Group.get(to_add)
            group.add_user(self._id, save=False)
            touched.append(group)
        for to_remove in current - desired:
            group = Group.get(to_remove)
            group.remove_user(self._id)
            touched.append(group)

        Group.bulk_save(touched)
        return bool(touched)
def set_groups ( self , group_ids ) : from corehq . apps . groups . models import Group desired = set ( group_ids ) current = set ( self . get_group_ids ( ) ) touched = [ ] for to_add in desired - current : group = Group . get ( to_add ) group . add_user ( self . _id , save = False ) touched . append ( group ) for to_remove in current - desired : group = Group . get ( to_remove ) group . remove_user ( self . _id ) touched . append ( group ) Group . bulk_save ( touched ) return bool ( touched )