def append_groups(self, account): exists = [] group_ids = [int(id) for id in self.request.params.getall("groups")] for group in account.groups: exists.append(group.id) if group.id not in group_ids: account.groups.remove(group) for group_id in self.request.params.getall("groups"): if group_id not in exists: account.groups.append(Group.by_id(self.session, group_id))
def append_groups(self, account): exists = [] group_ids = [int(id) for id in self.request.params.getall('groups')] for group in account.groups: exists.append(group.id) if group.id not in group_ids: account.groups.remove(group) for group_id in self.request.params.getall('groups'): if group_id not in exists: account.groups.append(Group.by_id(self.session, group_id))