本文整理汇总了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,