本文整理汇总了Python中app.models.Event.query_in_deployment方法的典型用法代码示例。如果您正苦于以下问题:Python Event.query_in_deployment方法的具体用法?Python Event.query_in_deployment怎么用?Python Event.query_in_deployment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Event
的用法示例。
在下文中一共展示了Event.query_in_deployment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: activity
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import query_in_deployment [as 别名]
def activity():
"""
View for the activity feed of recent events.
"""
events = Event.query_in_deployment().order_by(desc(Event.created_at)).limit(50).all()
shared_message_form = SharedMessageForm()
if request.method == "POST":
if not current_user.is_authenticated():
flash(gettext(u"You must log in to post a message."), "error")
elif not current_user.display_in_search:
flash(gettext(u"We need your name before you can post a message."), "error")
elif shared_message_form.validate():
data = shared_message_form.message.data
msg = SharedMessageEvent.from_user(current_user, message=data)
db.session.add(msg)
db.session.commit()
flash(gettext(u"Message posted!"))
return redirect(url_for("views.activity"))
return render_template(
"activity.html",
**{
"user": current_user,
"events": events,
"most_complete_profiles": User.get_most_complete_profiles(limit=5),
"most_connected_profiles": User.get_most_connected_profiles(limit=5),
}
)
示例2: get_latest_events
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import query_in_deployment [as 别名]
def get_latest_events(pageid=1):
return Event.query_in_deployment().order_by(desc(Event.created_at)).\
paginate(pageid)