本文整理汇总了Python中models.Channel.kind方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.kind方法的具体用法?Python Channel.kind怎么用?Python Channel.kind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Channel
的用法示例。
在下文中一共展示了Channel.kind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Channel [as 别名]
# 或者: from models.Channel import kind [as 别名]
def get(self, server, channel):
key = db.Key.from_path(Channel.kind(), '%s/%s' % (unquote(channel), server))
channel = Channel.get(key)
date = self.request.GET.get('date')
if date:
start_date = datetime.strptime(date, '%Y-%m-%d').date()
else:
start_date = datetime.utcnow().date()
end_date = start_date + timedelta(days=1)
messages = Message.all().filter('channel =', channel) \
.filter('timestamp >= ', start_date) \
.filter('timestamp < ', end_date) \
.order('timestamp')
# date based pagination
next_day = start_date + timedelta(days=1)
if next_day > datetime.utcnow().date():
next_day = None
previous_day = end_date - timedelta(days=2)
self.response.out.write(render('templates/channel.html', locals()))