本文整理汇总了Python中models.Images.get_backend_images方法的典型用法代码示例。如果您正苦于以下问题:Python Images.get_backend_images方法的具体用法?Python Images.get_backend_images怎么用?Python Images.get_backend_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Images
的用法示例。
在下文中一共展示了Images.get_backend_images方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import get_backend_images [as 别名]
def edit(self, id, **post):
image = Images.first(id=id)
if not image:
cherrypy.session['flash'] = "404 Image Not Found"
raise cherrypy.HTTPRedirect('/images')
if post:
fields = ['name', 'backend_id', 'description']
data = self._get_data('image', fields, post)
if image.update(data, fields):
cherrypy.session['flash'] = "Image successfully updated."
raise cherrypy.HTTPRedirect('/images')
cherrypy.session['flash'] = 'Invalid data'
backend_images = Images.get_backend_images()
env=dict(image = image, backend_images=backend_images)
return self.render("/images/edit.html", crumbs=self.crumbs, **env)
示例2: add
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import get_backend_images [as 别名]
def add(self, **post):
image = Images.new(name="", backend_id="", description="")
if post:
fields = ['name', 'backend_id', 'description']
data = self._get_data('image', fields, post)
self._set_data(image, data)
if image.validates() and Images.add(image):
cherrypy.session['flash'] = "Image added"
raise cherrypy.HTTPRedirect('/images')
cherrypy.session['flash'] = 'Invalid data'
backend_images = Images.get_backend_images()
env = dict(
image = image,
backend_images = backend_images
)
return self.render("/images/add.html", crumbs=self.crumbs, **env)