本文整理汇总了Python中models.Feed.for_user方法的典型用法代码示例。如果您正苦于以下问题:Python Feed.for_user方法的具体用法?Python Feed.for_user怎么用?Python Feed.for_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Feed
的用法示例。
在下文中一共展示了Feed.for_user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: feed_create
# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import for_user [as 别名]
def feed_create():
"""List all examples"""
form = FeedCreate(request.form)
if not form.validate():
return jsonify(status='error', message='The passed arguments failed validation')
if Feed.for_user(user=g.user).count():
return jsonify(status='error', message='This user has already created a feed')
exsisting_feeds = Feed.for_user_and_url(user=g.user, feed_url=form.data['feed_url'])
try:
feed = exsisting_feeds.iter().next()
except StopIteration:
feed = Feed.create_feed_from_form(g.user, form)
return jsonify(status='ok', data=feed.to_json())
示例2: feeds
# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import for_user [as 别名]
def feeds():
"""List all examples"""
users_feeds = [feed.to_json() for feed in Feed.for_user(g.user)]
return jsonify(status='ok', data=users_feeds)