当前位置: 首页>>代码示例>>Python>>正文


Python Entry.public方法代码示例

本文整理汇总了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)
开发者ID:ephiepark,项目名称:mysite,代码行数:9,代码来源:app.py

示例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)
开发者ID:keybits,项目名称:permanote,代码行数:14,代码来源:views.py

示例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=[])
开发者ID:econne01,项目名称:flask_blog,代码行数:14,代码来源:views.py

示例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)
开发者ID:keybits,项目名称:permanote,代码行数:6,代码来源:views.py


注:本文中的models.Entry.public方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。