Ejemplo n.º 1
0
    def get_context_data(self, **kwargs):
        context = super(GroupDescriptionDetailView,
                        self).get_context_data(**kwargs)
        workgroup = context['workgroup']

        # First be sure that the home Wiki article already exists
        try:
            home_article = Article.get_for_object(workgroup)
        except ArticleForObject.DoesNotExist:
            return redirect('workgroup-detail', slug=workgroup.slug)

        # now check that the description article exists
        try:
            desc_article = Article.get_for_object(home_article)
        except ArticleForObject.DoesNotExist:
            desc_article = Article.objects.create()
            desc_article.add_object_relation(home_article)
            revision = ArticleRevision(title="description of %s" %
                                       workgroup.name,
                                       content='')
            desc_article.add_revision(revision)

        context.update({
            'wiki_article': desc_article,
        })

        return context
Ejemplo n.º 2
0
   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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
    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.prefetch_related(
            'locations').all().order_by('?')

        return context
Ejemplo n.º 7
0
    def get_context_data(self, **kwargs):
        context = super(GroupDescriptionDetailView, self).get_context_data(**kwargs)
        workgroup = context['workgroup']
        
        # First be sure that the home Wiki article already exists
        try:
            home_article = Article.get_for_object(workgroup)            
        except ArticleForObject.DoesNotExist:
            return redirect('workgroup-detail', slug=workgroup.slug)
        
        # now check that the description article exists
        try:
            desc_article = Article.get_for_object(home_article) 
        except ArticleForObject.DoesNotExist:    
            desc_article = Article.objects.create()
            desc_article.add_object_relation(home_article)
            revision = ArticleRevision(title="description of %s" %workgroup.name, content='')
            desc_article.add_revision(revision)

        context.update({
             'wiki_article' : desc_article,                        
        })
        
        return context
 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