本文整理汇总了Python中app.models.Event.presenters方法的典型用法代码示例。如果您正苦于以下问题:Python Event.presenters方法的具体用法?Python Event.presenters怎么用?Python Event.presenters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Event
的用法示例。
在下文中一共展示了Event.presenters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Presenter
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import presenters [as 别名]
for presenter_info in presenter_infos:
presenter = Presenter(presenter_info[0], presenter_info[1])
presenter.email = presenter_info[2]
presenter.phone = presenter_info[3]
db.session.add(presenter)
# Commit the test data to the database.
db.session.commit()
# Assign a random set of presenters to each event.
events = Event.query.all()
presenters = Presenter.query.all()
for event in events:
# Randomly select from 0 to 4 presenters for this event.
random_presenters = random.sample(presenters, random.randrange(5))
event.presenters = random_presenters
# Commit the test data to the database.
db.session.commit()
# Add room groups.
room_group_names = (
'Algonquin',
'Charlevoix',
'Lobby',
)
for room_group_name in room_group_names:
room_group = RoomGroup(room_group_name)
db.session.add(room_group)