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


Python ModelResource.full_dehydrate方法代码示例

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


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

示例1: bundleItemCollection

# 需要导入模块: from tastypie.resources import ModelResource [as 别名]
# 或者: from tastypie.resources.ModelResource import full_dehydrate [as 别名]
def bundleItemCollection(modelResource, request, items):
    item_list = []
    for item in items:
        bundle = ModelResource.build_bundle(modelResource, obj=item, request=request)
        bundle = ModelResource.full_dehydrate(modelResource, bundle)
        item_list.append(bundle)
    return item_list;
开发者ID:ebuyukcan,项目名称:WiserWater,代码行数:9,代码来源:api_helpers.py

示例2: full_dehydrate

# 需要导入模块: from tastypie.resources import ModelResource [as 别名]
# 或者: from tastypie.resources.ModelResource import full_dehydrate [as 别名]
 def full_dehydrate(self, bundle, for_list=False):
     bundle = ModelResource.full_dehydrate(self, bundle, for_list=for_list)
     bundle.related_obj = self
     if for_list is True:
         fk = fields.ForeignKey(I4pProjectListResource, attribute="master", full=True)
         bundle.data["project"] = fk.dehydrate(bundle)
     return bundle
开发者ID:LittleFancy,项目名称:imaginationforpeople,代码行数:9,代码来源:project.py

示例3: full_dehydrate

# 需要导入模块: from tastypie.resources import ModelResource [as 别名]
# 或者: from tastypie.resources.ModelResource import full_dehydrate [as 别名]
 def full_dehydrate(self, bundle, for_list=False):
     bundle = ModelResource.full_dehydrate(self, bundle, for_list)
     if bundle.obj.picture:
         thumbnailer = get_thumbnailer(bundle.obj.picture)
         thumbnail_options = {'size': (ResizeThumbApi.width, ResizeThumbApi.height)}
         bundle.data["thumb"] = thumbnailer.get_thumbnail(thumbnail_options).url
     else:
         bundle.data["thumb"] = None
     if for_list is False:
         bundle.data["tags"] = [tag.name for tag in Tag.objects.get_for_object(bundle.obj)]
         if(bundle.obj.picture):
             thumbnail_options = {'size': (ResizeDisplay.width, ResizeDisplay.width)}
             bundle.data["image"] = thumbnailer.get_thumbnail(thumbnail_options).url
         else:
             bundle.data["image"] = None
         try:
             bundle.data["article"] = Article.get_for_object(bundle.obj).render()
         except ArticleForObject.DoesNotExist:
             bundle.data["article"] = None
     return bundle
开发者ID:Alive-AttemptTheLifeGangHouse,项目名称:imaginationforpeople,代码行数:22,代码来源:workgroup.py


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