本文整理匯總了Python中photos.models.Photo.get_media_type_display方法的典型用法代碼示例。如果您正苦於以下問題:Python Photo.get_media_type_display方法的具體用法?Python Photo.get_media_type_display怎麽用?Python Photo.get_media_type_display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類photos.models.Photo
的用法示例。
在下文中一共展示了Photo.get_media_type_display方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_album_photos_payload
# 需要導入模塊: from photos.models import Photo [as 別名]
# 或者: from photos.models.Photo import get_media_type_display [as 別名]
#.........這裏部分代碼省略.........
""" + order_limit_clause,
[user_id, user_id ,album_id])
photos = collections.OrderedDict()
for row in cursor.fetchall():
(row_photo_id,
row_youtube_id,
row_media_type,
row_client_upload_id,
row_photo_subdomain,
row_photo_date_created,
row_video_status,
row_video_storage_id,
row_video_duration,
row_photo_global_glance_score,
row_photo_my_glance_score,
row_author_id,
row_author_nickname,
row_author_last_online,
row_author_avatar_file,
row_author_user_glance_score) = row
if row_photo_my_glance_score:
my_glance_score_delta = row_photo_my_glance_score
else:
my_glance_score_delta = 0
# Manually create a Photo instance so we can use it's helper methods
photo = Photo(photo_id=row_photo_id, subdomain=row_photo_subdomain, media_type=row_media_type)
photos[row_photo_id] = {
'photo_id': row_photo_id,
'youtube_id': row_youtube_id,
'media_type': photo.get_media_type_display(),
'client_upload_id': row_client_upload_id,
'photo_url': photo.get_photo_url(),
'date_created': row_photo_date_created,
'author': {
'id': row_author_id,
'nickname': row_author_nickname,
'last_online': row_author_last_online,
'avatar_url': avatar_url_from_avatar_file_data(row_author_avatar_file),
'user_glance_score': row_author_user_glance_score
},
'comments': [], # Will be filled in later
'user_tags': [], # Not used yet, will be left empty
'glances': [], # Deprecated, will be left empty
'global_glance_score': row_photo_global_glance_score,
'my_glance_score_delta': my_glance_score_delta
}
if photo.is_video():
# Manually create a Video instance so we can use it's helper methods
video = Video(status=row_video_status)
photos[row_photo_id]['video_status'] = video.get_status_display()
photos[row_photo_id]['video_url'] = Video.get_video_url(row_video_storage_id)
photos[row_photo_id]['video_thumbnail_url'] = Video.get_video_thumbnail_url(row_video_storage_id)
photos[row_photo_id]['video_duration'] = row_video_duration
cursor = connection.cursor()
cursor.execute(
"""
SELECT photos_photo.photo_id,
phone_auth_user.id,
phone_auth_user.nickname,
phone_auth_user.last_online,
phone_auth_user.avatar_file,