def setup_user(): users = [ ("*****@*****.**", "test", "admin"), ("*****@*****.**", "test", "user"), ("*****@*****.**", "test", "guest"), ] groups = {} for username, password, group_name in users: user = UserModel(username=username) user.password = password DBSession.add(user) if group_name not in groups: group = GroupModel(group_name=group_name) DBSession.add(group) groups[group_name] = group user.groups.append(groups[group_name])
def setup_news(): entity = NewsModel(title=u"Hello, world!", body=u"This is a news.") DBSession.add(entity)