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


Python Album.query方法代码示例

本文整理汇总了Python中models.Album.query方法的典型用法代码示例。如果您正苦于以下问题:Python Album.query方法的具体用法?Python Album.query怎么用?Python Album.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Album的用法示例。


在下文中一共展示了Album.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import query [as 别名]
    def get(self):
        query = Album.query().order(-Album.date_created)

        albums = get_covered_albums(query, 3)

        template_values = {
            'albums': albums,
        }

        self.render_template('index.html', template_values)
开发者ID:MichaelAquilina,项目名称:Photo-Nebula,代码行数:12,代码来源:views.py

示例2: get

# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import query [as 别名]
	def get(self):
		if len(self.request.GET) and self.request.GET['cancel']:
			urlstring = self.request.GET['cancel']
			album_key = ndb.Key(urlsafe=urlstring)
			album_key.delete()
		# Order by recently added
		album = Album.query(Album.album_type == 'oddmanout').order(-Album.date)
		template_values = {
			'album_store': album
		}
		template = JINJA_ENVIRONMENT.get_template('oddmanout.html')
		self.response.write(template.render(template_values))
开发者ID:nischalshrestha,项目名称:recognize,代码行数:14,代码来源:recognize.py

示例3: get

# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import query [as 别名]
    def get(self):
        if users.is_current_user_admin():
            photos = Image.query().fetch()
            albums = Album.query().fetch()
            for photo in photos:
                photo_key = ndb.Key(urlsafe=photo.ukey())
                photo_key.delete()
            for album in albums:
                album_key = ndb.Key(urlsafe=album.ukey())
                album_key.delete()

        self.redirect('/')
开发者ID:IanChilds,项目名称:ButtonsAndLace,代码行数:14,代码来源:delete_albums.py

示例4: albums_list

# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import query [as 别名]
 def albums_list(self, request):
   current_user = endpoints.get_current_user()
   album_type = request.type
   email = (current_user.email() if current_user is not None
          else 'Anonymous')
   albums = Album.query(Album.album_type == album_type).order(-Album.date)
   items = []
   for album in albums:
     a = AlbumMessage(album_id=album.album_id,
                       title=album.title, 
                       category=album.category, 
                       album_type=album.album_type, 
                       date=str(album.date.date()))
     questions = Question.query(ancestor=album.key).order(-Question.date).fetch()
     for q in questions:
       q_msg = QuestionMessage(question_id=q.question_id, title=q.title, fact=q.fact)
       q_images = q.images
       for image in q_images:
         q_msg.images.append(ImageMessage(title=image.title, correct=image.correct, image_url=image.image))
       a.questions.append(q_msg)
     items.append(a)
   return AlbumCollection(albums=items)
开发者ID:nischalshrestha,项目名称:recognize,代码行数:24,代码来源:recognize_api.py


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