本文整理汇总了Python中models.News.select方法的典型用法代码示例。如果您正苦于以下问题:Python News.select方法的具体用法?Python News.select怎么用?Python News.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.News
的用法示例。
在下文中一共展示了News.select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: project
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def project(news_id):
news = News.select().where(
News.category == 'PROJECT'
).order_by(News.time.desc()).limit(10)
project = News.select().where(
News.id == news_id
).get()
return render_template('articles/project.html', news=project, project_list = news)
示例2: notification
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def notification():
news = News.select().where(
News.category == 'NEWS'
).order_by(News.time.desc()).limit(6)
events = News.select().where(
News.category == 'ACTIVITY'
).order_by(News.time.desc()).limit(6)
#展示最新的6个新闻摘要news_list和活动摘要events_list
return render_template('notification.html',
news_list = news, events_list = events)
示例3: events
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def events(news_id):
news = News.select().where(
News.id == news_id
).get()
#news_list
news_list = News.select().where(
News.category == 'ACTIVITY'
).order_by(News.time.desc()).limit(10)
#print news.title
return render_template('articles/events.html',
news = news, events_list = news_list)
示例4: news
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def news(news_id):
news = News.select().where(
News.id == news_id
).get()
#news_list
news_list = News.select().where(
News.category == 'NEWS'
).order_by(News.time.desc()).limit(10)
#最新的10个新闻news_list 及指定的新闻文章news
return render_template('articles/news.html',
news = news, news_list = news_list)
示例5: index
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def index():
notifications = News.select().where(
News.category == 'NOTIFICATION'
).order_by(News.time.desc()).limit(5)
news = News.select().where(
News.category == 'NEWS'
).order_by(News.time.desc()).limit(6)
pics = News.select().where(
News.category == 'PICTURE'
)
pic_num = pics.count()
#通知与公告 notification 热门新闻 news
return render_template('index.html',
notification_list = notifications,
news_list = news, pics=pics, pic_num=pic_num)
示例6: news_list
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def news_list():
#news_list
news_list = News.select().where(
News.category == 'NEWS'
).order_by(News.time.desc()).limit(20)
return render_template('articles/n_list.html', news_list = news_list)
示例7: projects
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def projects():
news = News.select().where(
News.category == 'PROJECT'
).order_by(News.time.desc()).limit(10)
return render_template('projects.html', project_list = news)
示例8: events_list
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import select [as 别名]
def events_list():
#news_list
news_list = News.select().where(
News.category == 'ACTIVITY'
).order_by(News.time.desc()).limit(20)
return render_template('articles/e_list.html', events_list = news_list)