本文整理汇总了Python中models.Channel.query方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.query方法的具体用法?Python Channel.query怎么用?Python Channel.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Channel
的用法示例。
在下文中一共展示了Channel.query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send
# 需要导入模块: from models import Channel [as 别名]
# 或者: from models.Channel import query [as 别名]
def send(event, message):
from models import Channel
for channel in Channel.query():
channel.send({
'event': event,
'data': message
})
示例2: list_channels
# 需要导入模块: from models import Channel [as 别名]
# 或者: from models.Channel import query [as 别名]
def list_channels():
"""List all channels"""
channels = Channel.query()
form = ChannelForm()
if form.validate_on_submit():
channel = Channel(
id = form.id.data,
name = form.name.data,
token = form.token.data,
)
try:
channel.put()
flash(u'Channel %s successfully saved.' % channel.id, 'success')
return redirect(url_for('qq.list_channels'))
except CapabilityDisabledError:
flash(u'App Engine Datastore is currently in read-only mode.', 'info')
return redirect(url_for('qq.list_channels'))
return render_template('list_channels.html', channels=channels, form=form)