本文整理汇总了Python中models.List.all方法的典型用法代码示例。如果您正苦于以下问题:Python List.all方法的具体用法?Python List.all怎么用?Python List.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.List
的用法示例。
在下文中一共展示了List.all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import List [as 别名]
# 或者: from models.List import all [as 别名]
def get(self, version):
if not self.valid_version(version):
self.error(404, "API Version %s not supported" % version)
return
query = List.all().order('name')
data = [s.rest(self.base_url(version)) for s in query]
data = {"lists": data}
self.json(data)
示例2: get
# 需要导入模块: from models import List [as 别名]
# 或者: from models.List import all [as 别名]
def get(self):
td = {
"services_selected": True,
"url": "/admin/api/v1/services",
"action": "create",
"service_lists": List.all().fetch(100),
}
td.update(site.default_template_data())
self.render(td, 'admin/services_create.html')
示例3: post
# 需要导入模块: from models import List [as 别名]
# 或者: from models.List import all [as 别名]
def post(self, version, service_slug):
if not self.valid_version(version):
self.error(404, "API Version %s not supported" % version)
return
service = Service.get_by_slug(service_slug)
if not service:
self.error(404, "Service %s does not exist" % service_slug)
return
name = self.request.get('name', default_value=None)
description = self.request.get('description', default_value=None)
list = self.request.get('list', default_value=None)
if description:
service.description = description
if name:
service.name = name
if list:
l = List.all().filter("slug = ", list).get()
if l is None:
self.error(400, "Can't find list with slug %s" % list)
return
service.list = l
if "" == list:
service.list = None
list = "removed"
if name or description or list:
invalidate_cache()
service.put()
self.json(service.rest(self.base_url(version)))
示例4: get
# 需要导入模块: from models import List [as 别名]
# 或者: from models.List import all [as 别名]
def get(self):
lists = List.all().order('-last_fetched_time')
render(self, 'index.html', lists = lists)