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


Python Article.get_for_object方法代码示例

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


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

示例1: dispatch

# 需要导入模块: from wiki.models.article import Article [as 别名]
# 或者: from wiki.models.article.Article import get_for_object [as 别名]
   def dispatch(self, request, workgroup_slug, *args, **kwargs):   
       self.workgroup = get_object_or_404(WorkGroup, slug=workgroup_slug)         
       article = Article.get_for_object(Article.get_for_object(self.workgroup)) 
       
       self.sidebar_plugins = plugin_registry.get_sidebar()
       self.sidebar = []
 
       return super(WikiEdit, self).dispatch(request, article, *args, **kwargs)
开发者ID:Gnuside,项目名称:imaginationforpeople,代码行数:10,代码来源:views.py

示例2: get_context_data

# 需要导入模块: from wiki.models.article import Article [as 别名]
# 或者: from wiki.models.article.Article import get_for_object [as 别名]
    def get_context_data(self, **kwargs):
        """
        Adds the member of the associated ML if there's one
        """
        context = super(GroupDetailView, self).get_context_data(**kwargs)
        
        workgroup = context['workgroup']

        # Look up mailing list members
        context.update(lookup_ml_membership(workgroup))

        # Wiki
        try:
            article = Article.get_for_object(workgroup)
        except ArticleForObject.DoesNotExist:
            article = Article.objects.create()
            article.add_object_relation(workgroup)
            revision = ArticleRevision(title=workgroup.name, content='')
            article.add_revision(revision)

        context['wiki_article'] = article
        
        context['group_projects'] = workgroup.projects.all()
            
        return context
开发者ID:Gnuside,项目名称:imaginationforpeople,代码行数:27,代码来源:views.py

示例3: full_dehydrate

# 需要导入模块: from wiki.models.article import Article [as 别名]
# 或者: from wiki.models.article.Article import get_for_object [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


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