本文整理匯總了Python中models.Pages.objects方法的典型用法代碼示例。如果您正苦於以下問題:Python Pages.objects方法的具體用法?Python Pages.objects怎麽用?Python Pages.objects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Pages
的用法示例。
在下文中一共展示了Pages.objects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: pages
# 需要導入模塊: from models import Pages [as 別名]
# 或者: from models.Pages import objects [as 別名]
def pages():
if request.method == "POST":
shreds = set(request.form.getlist("shreds"))
page_name = request.form.get("page_name")
page_id = request.form.get("page_id")
if page_id:
page = Pages.objects.get(pk=page_id)
else:
page, _ = Pages.objects.get_or_create(
created_by=g.user.id, name=page_name)
page.update(add_to_set__shreds=shreds)
for shred in Cluster.objects(id__in=shreds):
tags = shred.get_user_tags(g.user)
if tags is not None:
tags.pages = list(set(tags.pages + [page]))
# TODO: else 404?
shred.save()
pages = Pages.objects(created_by=g.user.id)
return render_template(
"_pages.html",
pages=pages)
示例2: review
# 需要導入模塊: from models import Pages [as 別名]
# 或者: from models.Pages import objects [as 別名]
def review():
page = int(request.args.get('page', 1))
items = (Cluster
.objects(users_processed=g.user.id)
.paginate(page=page, per_page=20))
pages = Pages.objects(created_by=g.user.id)
return render_template("review.html", items=items, pages=pages)
示例3: review
# 需要導入模塊: from models import Pages [as 別名]
# 或者: from models.Pages import objects [as 別名]
def review():
page = int(request.args.get('page', 1))
shreds = (Shreds
.objects(users_processed=g.user.id)
.exclude("features", "contour") # 10x speedup
.paginate(page=page, per_page=20))
pages = Pages.objects(created_by=g.user.id)
return render_template("review.html", shreds=shreds, pages=pages)