本文整理汇总了Python中models.Entry.public方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.public方法的具体用法?Python Entry.public怎么用?Python Entry.public使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Entry
的用法示例。
在下文中一共展示了Entry.public方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: detail
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import public [as 别名]
def detail(slug):
if session.get('logged_in'):
query = Entry.select()
else:
query = Entry.public()
entry = get_object_or_404(query, Entry.slug == slug)
return render_template('detail.html', entry=entry)
示例2: index
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import public [as 别名]
def index():
search_query = request.args.get("q")
if search_query:
query = Entry.search(search_query)
else:
query = Entry.public().order_by(Entry.timestamp.desc())
# The `object_list` helper will take a base query and then handle
# paginating the results if there are more than 20. For more info see
# the docs:
# http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#object_list
return object_list("index.html", query, search=search_query, check_bounds=False)
示例3: index
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import public [as 别名]
def index():
search_query = request.args.get('q')
if search_query:
query = Entry.search(search_query)
else:
query = Entry.public().order_by(Entry.last_mod_date.desc())
try:
return object_list('index.html', query)
except NotFound as exc:
# peewee throws 404 `NotFound` Exception if no results found
# but we would rather show page with no results
return render_template('index.html', object_list=[])
示例4: thistag
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import public [as 别名]
def thistag(tag):
search_query = request.args.get("q")
query = Entry.public().select().join(EntryTags).join(Tag).where((Tag.tag == tag)).order_by(Entry.timestamp.desc())
return object_list("index.html", query, tag=tag, search=search_query, check_bounds=False)