本文整理汇总了Python中utils.prepend_base函数的典型用法代码示例。如果您正苦于以下问题:Python prepend_base函数的具体用法?Python prepend_base怎么用?Python prepend_base使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepend_base函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_images
def get_images(self, obj):
return {
'waveform_m': prepend_base(obj.locations("display.wave.M.url"), request_is_secure=self.context['request'].using_https),
'waveform_l': prepend_base(obj.locations("display.wave.L.url"), request_is_secure=self.context['request'].using_https),
'spectral_m': prepend_base(obj.locations("display.spectral.M.url"), request_is_secure=self.context['request'].using_https),
'spectral_l': prepend_base(obj.locations("display.spectral.L.url"), request_is_secure=self.context['request'].using_https),
}
开发者ID:darad,项目名称:freesound,代码行数:7,代码来源:serializers.py
示例2: get_previews
def get_previews(self, obj):
return {
'preview-hq-mp3': prepend_base(obj.locations("preview.HQ.mp3.url"), request_is_secure=self.context['request'].using_https),
'preview-hq-ogg': prepend_base(obj.locations("preview.HQ.ogg.url"), request_is_secure=self.context['request'].using_https),
'preview-lq-mp3': prepend_base(obj.locations("preview.LQ.mp3.url"), request_is_secure=self.context['request'].using_https),
'preview-lq-ogg': prepend_base(obj.locations("preview.LQ.ogg.url"), request_is_secure=self.context['request'].using_https),
}
开发者ID:darad,项目名称:freesound,代码行数:7,代码来源:serializers.py
示例3: get_avatar
def get_avatar(self, obj):
if obj.profile.has_avatar:
return {
'Small': prepend_base(obj.profile.locations()['avatar']['S']['url'], request_is_secure=self.context['request'].using_https),
'Medium': prepend_base(obj.profile.locations()['avatar']['M']['url'], request_is_secure=self.context['request'].using_https),
'Large': prepend_base(obj.profile.locations()['avatar']['L']['url'], request_is_secure=self.context['request'].using_https),
}
else:
return None
开发者ID:darad,项目名称:freesound,代码行数:9,代码来源:serializers.py
示例4: get_pack
def get_pack(self, obj):
try:
if obj.pack:
return prepend_base(reverse('apiv2-pack-instance', args=[obj.pack.id]), request_is_secure=self.context['request'].using_https)
else:
return None
except:
return None
开发者ID:darad,项目名称:freesound,代码行数:8,代码来源:serializers.py
示例5: get_user
def get_user(self, obj):
return prepend_base(reverse('apiv2-user-instance', args=[obj.user.username]), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:2,代码来源:serializers.py
示例6: get_sounds
def get_sounds(self, obj):
return prepend_base(reverse('apiv2-user-bookmark-category-sounds', args=[obj.user.username, obj.id]), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:2,代码来源:serializers.py
示例7: get_url
def get_url(self, obj):
if obj.id != 0:
return prepend_base(reverse('bookmarks-for-user-for-category', args=[obj.user.username, obj.id]), request_is_secure=self.context['request'].using_https)
else:
return prepend_base(reverse('bookmarks-for-user', args=[obj.user.username]), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:5,代码来源:serializers.py
示例8: get_uri
def get_uri(self, obj):
return prepend_base(reverse('apiv2-pack-instance', args=[obj.id]), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:2,代码来源:serializers.py
示例9: get_comments
def get_comments(self, obj):
return prepend_base(reverse('apiv2-sound-comments', args=[obj.id]), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:2,代码来源:serializers.py
示例10: get_bookmark
def get_bookmark(self, obj):
return prepend_base(reverse('apiv2-user-create-bookmark', args=[obj.id]), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:2,代码来源:serializers.py
示例11: get_analysis_frames
def get_analysis_frames(self, obj):
return prepend_base(obj.locations('analysis.frames.url'), request_is_secure=self.context['request'].using_https)
开发者ID:darad,项目名称:freesound,代码行数:2,代码来源:serializers.py
示例12: get_avatar
def get_avatar(self, obj):
return {
'small': prepend_base(obj.profile.locations()['avatar']['S']['url'], request_is_secure=self.context['request'].using_https),
'medium': prepend_base(obj.profile.locations()['avatar']['M']['url'], request_is_secure=self.context['request'].using_https),
'large': prepend_base(obj.profile.locations()['avatar']['L']['url'], request_is_secure=self.context['request'].using_https),
}
开发者ID:hossainmurad,项目名称:freesound,代码行数:6,代码来源:serializers.py
注:本文中的utils.prepend_base函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论