Example #1
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     c['parent_urlpath'] = self.urlpath
     c['parent_article'] = self.article
     c['create_form'] = kwargs.pop('form', None)
     c['editor'] = editors.getEditor()
     return c
Example #2
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     c["parent_urlpath"] = self.urlpath
     c["parent_article"] = self.article
     c["create_form"] = kwargs.pop("form", None)
     c["editor"] = editors.getEditor()
     return c
Example #3
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs['selected_tab'] = 'history'
     return kwargs
Example #4
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     c['form'] = self.get_form()
     c['parent_urlpath'] = self.urlpath
     c['parent_article'] = self.article
     c['create_form'] = c.pop('form', None)
     c['editor'] = editors.getEditor()
     return c
Example #5
0
 def dispatch(self, request, article, *args, **kwargs):
     self.template = get_object_or_404(
         models.Template,
         id=kwargs.get('template_id', None)
     )
     if not self.template.can_write(request.user):
         return redirect(wiki_settings.LOGIN_URL)
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #6
0
 def get_context_data(self, **kwargs):
     # Needed since Django 1.9 because get_context_data is no longer called
     # with the form instance
     if 'form' not in kwargs:
         kwargs['form'] = self.get_form()
     kwargs = ArticleMixin.get_context_data(self, **kwargs)
     kwargs.update(FormView.get_context_data(self, **kwargs))
     return kwargs
Example #7
0
 def get_context_data(self, **kwargs):
     kwargs['title'] = _(
         'Preview Template: %s'
     ) % self.title
     kwargs['revision'] = None
     kwargs['content'] = self.template_content
     kwargs['preview'] = self.preview
     return ArticleMixin.get_context_data(self, **kwargs)
Example #8
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs['selected_tab'] = 'history'
     return kwargs
Example #9
0
 def get_context_data(self, **kwargs):
     # Needed since Django 1.9 because get_context_data is no longer called
     # with the form instance
     if "form" not in kwargs:
         kwargs["form"] = self.get_form()
     kwargs = ArticleMixin.get_context_data(self, **kwargs)
     kwargs.update(FormView.get_context_data(self, **kwargs))
     return kwargs
Example #10
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     c["form"] = self.get_form()
     c["parent_urlpath"] = self.urlpath
     c["parent_article"] = self.article
     c["create_form"] = c.pop("form", None)
     c["editor"] = editors.getEditor()
     return c
Example #11
0
 def dispatch(self, request, article, *args, **kwargs):
     self.image = get_object_or_404(models.Image,
                                    article=article,
                                    id=kwargs.get('image_id', None))
     self.revision = get_object_or_404(models.ImageRevision,
                                       plugin__article=article,
                                       id=kwargs.get('rev_id', None))
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #12
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'view'
     # try: # TODO: try to remove this
     #     #kwargs['metadata'] = self.article.current_revision.metadatarevision # TODO: I think this pointer is not being updated properly
     #     if self.metadata:
     #         kwargs['metadata'] = self.metadata
     # except:
     #     pass
     return ArticleMixin.get_context_data(self, **kwargs)
Example #13
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs['search_form'] = forms.SearchForm(self.request.GET)
     kwargs['query'] = self.query
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs['selected_tab'] = 'template'
     return kwargs
Example #14
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs['selected_tab'] = 'history'
     if hasattr(site_settings,'PRIVATE_WIKI') and site_settings.PRIVATE_WIKI and self.request.user.is_anonymous():
         raise Http404()
     return kwargs
Example #15
0
 def dispatch(self, request, article, *args, **kwargs):
     self.image = get_object_or_404(models.Image, article=article,
                                    id=kwargs.get('image_id', None))
     self.revision = get_object_or_404(
         models.ImageRevision,
         plugin__article=article,
         id=kwargs.get(
             'rev_id',
             None))
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #16
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs['search_form'] = forms.SearchForm(self.request.GET)
     kwargs['query'] = self.query
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs['selected_tab'] = 'attachments'
     return kwargs
Example #17
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs["search_form"] = forms.SearchForm(self.request.GET)
     kwargs["query"] = self.query
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs["selected_tab"] = "attachments"
     return kwargs
Example #18
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     # Needed since Django 1.9 because get_context_data is no longer called
     # with the form instance
     if 'form' not in c:
         c['form'] = self.get_form()
     c['parent_urlpath'] = self.urlpath
     c['parent_article'] = self.article
     c['create_form'] = c.pop('form', None)
     c['editor'] = editors.getEditor()
     return c
Example #19
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context["selected_tab"] = "view"
     article_context = ArticleMixin.get_context_data(self, **kwargs)
     descendants = article_context["urlpath"].root().get_descendants()
     descendants = [
         descendant for descendant in descendants
         if descendant.article.can_read(self.request.user)
     ]
     article_context["descendants"] = descendants
     return article_context
Example #20
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['selected_tab'] = 'view'
     article_context = ArticleMixin.get_context_data(self, **kwargs)
     descendants = article_context['urlpath'].root().get_descendants()
     descendants = [
         descendant for descendant in descendants
         if descendant.article.can_read(self.request.user)
     ]
     article_context['descendants'] = descendants
     return article_context
Example #21
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     # Needed since Django 1.9 because get_context_data is no longer called
     # with the form instance
     if "form" not in c:
         c["form"] = self.get_form()
     c["parent_urlpath"] = self.urlpath
     c["parent_article"] = self.article
     c["create_form"] = c.pop("form", None)
     c["editor"] = editors.getEditor()
     return c
Example #22
0
 def get_context_data(self, **kwargs):
     c = ArticleMixin.get_context_data(self, **kwargs)
     # Needed since Django 1.9 because get_context_data is no longer called
     # with the form instance
     if 'form' not in c:
         c['form'] = self.get_form()
     c['parent_urlpath'] = self.urlpath
     c['parent_article'] = self.article
     c['create_form'] = c.pop('form', None)
     c['editor'] = editors.getEditor()
     return c
Example #23
0
 def get_context_data(self, **kwargs):
     # Is this a bit of a hack? Use better inheritance?
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs_listview = ListView.get_context_data(self, **kwargs)
     kwargs.update(kwargs_article)
     kwargs.update(kwargs_listview)
     kwargs['selected_tab'] = 'history'
     # try:  # TODO: remove
     #     kwargs['metadataRevisions'] = SupersenseRevision.objects.all()
     # except:
     #     pass
     return kwargs
Example #24
0
    def get_context_data(self, **kwargs):
        try:
            models.SimpleMetadata.objects.get(article=Article.objects.get(
                urlpath=URLPath.objects.get(slug='supersenses')))
            models.SimpleMetadata.objects.get(article=Article.objects.get(
                urlpath=URLPath.objects.get(slug='construals')))
            kwargs['install'] = ''
        except (URLPath.DoesNotExist, Article.DoesNotExist,
                models.SimpleMetadata.DoesNotExist):
            kwargs['install'] = mark_safe(
                '<h2><a href="installmetadata">Install metadata</a></h2>')

        return ArticleMixin.get_context_data(self, **kwargs)
Example #25
0
    def get_context_data(self, **kwargs):
        kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
        kwargs_listview = ListView.get_context_data(self, **kwargs)
        kwargs.update(kwargs_article)
        kwargs.update(kwargs_listview)
        kwargs['filter_query'] = self.query
        kwargs['filter_form'] = self.filter_form

        # Update each child's ancestor cache so the lookups don't have
        # to be repeated.
        updated_children = kwargs[self.context_object_name]
        for child in updated_children:
            child.set_cached_ancestors_from_parent(self.urlpath)
        kwargs[self.context_object_name] = updated_children

        return kwargs
Example #26
0
    def get_context_data(self, **kwargs):
        kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
        kwargs_listview = ListView.get_context_data(self, **kwargs)
        kwargs.update(kwargs_article)
        kwargs.update(kwargs_listview)
        kwargs['filter_query'] = self.query
        kwargs['filter_form'] = self.filter_form

        # Update each child's ancestor cache so the lookups don't have
        # to be repeated.
        updated_children = kwargs[self.context_object_name]
        for child in updated_children:
            child.set_cached_ancestors_from_parent(self.urlpath)
        kwargs[self.context_object_name] = updated_children

        return kwargs
Example #27
0
 def get_context_data(self, **kwargs):
     kwargs['path'] = ''
     return ArticleMixin.get_context_data(self, **kwargs)
Example #28
0
 def dispatch(self, request, article, *args, **kwargs):
     self.image = get_object_or_404(models.Image, article=article,
                                    id=kwargs.get('image_id', None))
     if not self.image.can_write(user=request.user):
         return redirect(wiki_settings.LOGIN_URL)
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #29
0
 def get_context_data(self, **kwargs):
     kwargs["title"] = self.title
     kwargs["revision"] = self.revision
     kwargs["content"] = self.content
     kwargs["preview"] = self.preview
     return ArticleMixin.get_context_data(self, **kwargs)
Example #30
0
 def get_context_data(self, **kwargs):
     kwargs.update(ArticleMixin.get_context_data(self, **kwargs))
     return ListView.get_context_data(self, **kwargs)
Example #31
0
 def get_context_data(self, **kwargs):
     kwargs["selected_tab"] = "view"
     return ArticleMixin.get_context_data(self, **kwargs)
Example #32
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'attachments'
     return ArticleMixin.get_context_data(self, **kwargs)
Example #33
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'attachments'
     return ArticleMixin.get_context_data(self, **kwargs)
Example #34
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'view'
     kwargs_article = ArticleMixin.get_context_data(self, **kwargs)
     kwargs.update(kwargs_article)
     return ArticleMixin.get_context_data(self, **kwargs)
Example #35
0
 def dispatch(self, request, article, *args, **kwargs):
     self.image = get_object_or_404(models.Image,
                                    article=article,
                                    id=kwargs.get('image_id', None))
     self.restore = kwargs.get('restore', False)
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #36
0
 def get_context_data(self, **kwargs):
     kwargs['title'] = self.title
     kwargs['revision'] = self.revision
     kwargs['content'] = self.content
     kwargs['preview'] = self.preview
     return ArticleMixin.get_context_data(self, **kwargs)
Example #37
0
 def dispatch(self, request, article, *args, **kwargs):
     self.args = args
     self.kwargs = kwargs
     self.preview = kwargs.get('preview', True)
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #38
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'source'
     return ArticleMixin.get_context_data(self, **kwargs)
Example #39
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'attachments'
     if 'form' not in kwargs:
         kwargs['form'] = self.get_form()
     return ArticleMixin.get_context_data(self, **kwargs)
Example #40
0
 def get_context_data(self, **kwargs):
     kwargs["selected_tab"] = "view"
     return ArticleMixin.get_context_data(self, **kwargs)
Example #41
0
 def get_context_data(self, **kwargs):
     kwargs["title"] = self.title
     kwargs["revision"] = self.revision
     kwargs["content"] = self.content
     kwargs["preview"] = self.preview
     return ArticleMixin.get_context_data(self, **kwargs)
Example #42
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'source'
     if hasattr(site_settings,'PRIVATE_WIKI') and site_settings.PRIVATE_WIKI and self.request.user.is_anonymous():
         return ''
     return ArticleMixin.get_context_data(self, **kwargs)
Example #43
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'source'
     return ArticleMixin.get_context_data(self, **kwargs)
Example #44
0
 def get_context_data(self, **kwargs):
     kwargs = ArticleMixin.get_context_data(self, **kwargs)
     kwargs.update(FormView.get_context_data(self, **kwargs))
     return kwargs
Example #45
0
 def get_context_data(self, **kwargs):
     kwargs["selected_tab"] = "attachments"
     return ArticleMixin.get_context_data(self, **kwargs)
Example #46
0
 def get_context_data(self, **kwargs):
     kwargs.update(ArticleMixin.get_context_data(self, **kwargs))
     return ListView.get_context_data(self, **kwargs)
Example #47
0
 def get_context_data(self, **kwargs):
     kwargs["selected_tab"] = "attachments"
     if "form" not in kwargs:
         kwargs["form"] = self.get_form()
     return ArticleMixin.get_context_data(self, **kwargs)
Example #48
0
 def dispatch(self, request, article, *args, **kwargs):
     self.image = get_object_or_404(models.Image, article=article,
                                    id=kwargs.get('image_id', None))
     self.restore = kwargs.get('restore', False)
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #49
0
 def get_context_data(self, **kwargs):
     kwargs['selected_tab'] = 'attachments'
     if 'form' not in kwargs:
         kwargs['form'] = self.get_form()
     return ArticleMixin.get_context_data(self, **kwargs)
Example #50
0
 def dispatch(self, request, article, *args, **kwargs):
     self.image = get_object_or_404(models.Image, article=article,
                                    id=kwargs.get('image_id', None))
     if not self.image.can_write(request.user):
         return redirect(wiki_settings.LOGIN_URL)
     return ArticleMixin.dispatch(self, request, article, *args, **kwargs)
Example #51
0
 def get_context_data(self, **kwargs):
     kwargs['title'] = self.title
     kwargs['revision'] = self.revision
     kwargs['content'] = self.content
     kwargs['preview'] = self.preview
     return ArticleMixin.get_context_data(self, **kwargs)
Example #52
0
 def get_context_data(self, **kwargs):
     kwargs = ArticleMixin.get_context_data(self, **kwargs)
     kwargs.update(FormView.get_context_data(self, **kwargs))
     return kwargs