def group_add_user(group, user_id=None, username=None):
 if user_id:
  user = get_object(User, id=user_id)
 else:
  user = get_object(User, username=username)
 if user:
  group.user_set.add(user)

def group_add_user ( group , user_id = None , username = None ) : if user_id : user = get_object ( User , id = user_id ) else : user = get_object ( User , username = username ) if user : group . user_set . add ( user )
usergroup add a user .