本文整理汇总了Python中models.Entry.latest_published方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.latest_published方法的具体用法?Python Entry.latest_published怎么用?Python Entry.latest_published使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Entry
的用法示例。
在下文中一共展示了Entry.latest_published方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: published_entries_for_feed
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import latest_published [as 别名]
def published_entries_for_feed(feed_id):
feed = Feed.get_by_id(feed_id, parent=g.user.key)
if not feed:
return jsonify_error(message="Can't find that feed")
feed_data = feed.to_json()
entries = [entry.to_json(include=['title', 'link', 'published', 'published_at'])
for entry in Entry.latest_published(feed).fetch(20)]
feed_data['entries'] = entries
return jsonify(status='ok', data=feed_data)
示例2: save_feed_preview
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import latest_published [as 别名]
def save_feed_preview(feed_id):
"""preview a saved feed"""
form = FeedUpdate(request.args)
if not form.validate():
return jsonify_error(message="Invalid update data")
feed = Feed.get_by_id(feed_id, parent=g.user.key)
if not feed:
return jsonify_error(message="Can't find that feed")
form.populate_obj(feed)
feed.preview = True
preview_entries = Entry.entry_preview(Entry.latest_published(feed).fetch(3), feed, format=True)
return jsonify(status='ok', data=preview_entries)