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