From 0204d723eec1c0a5f19c7f7abd012f046f7353a4 Mon Sep 17 00:00:00 2001 From: Yader Velasquez Date: Thu, 3 Jun 2021 11:50:43 -0600 Subject: [PATCH] New template tag to get article tree used in wiki navigation --- src/wiki/templatetags/wiki_tags.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wiki/templatetags/wiki_tags.py b/src/wiki/templatetags/wiki_tags.py index 1e23a377..0a84367e 100644 --- a/src/wiki/templatetags/wiki_tags.py +++ b/src/wiki/templatetags/wiki_tags.py @@ -9,6 +9,7 @@ from django.forms import BaseForm from django.template.defaultfilters import striptags from django.utils.http import urlquote from django.utils.safestring import mark_safe + from wiki import models from wiki.conf import settings from wiki.core.plugins import registry as plugin_registry @@ -213,3 +214,9 @@ def wiki_settings(name): @register.filter def starts_with(value, arg): return value.startswith(arg) + +@register.simple_tag +def get_article_tree(node): + if not node.is_root_node(): + node = node.get_root() + return node.get_children() -- 2.45.2