當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。