سؤال

I'm using Django MPTT to handle my hierarchical Data in my Django application. I'd like to render a TreeView using the recursetree tag. However, with this code :

{% recursetree system_list %}
    <li>{{ node.title }}
        {% if not node.is_leaf_node %}
            <ul>
                {{ children.title }}
            </ul>
        {% endif %}
    </li>
{% endrecursetree %}

I get such a markup :

              <li>Uppeur kar parK

            <ul>

    &lt;Li&gt;Caillou

            &lt;Ul&gt;

    &amp;Lt;Li&amp;Gt;Patate

    &amp;Lt;/Li&amp;Gt;

    &amp;Lt;Li&amp;Gt;Courgette

    &amp;Lt;/Li&amp;Gt;

    &amp;Lt;Li&amp;Gt;Artichaud

    &amp;Lt;/Li&amp;Gt;

    &amp;Lt;Li&amp;Gt;Brocoli

    &amp;Lt;/Li&amp;Gt;

            &lt;/Ul&gt;

    &lt;/Li&gt;

    &lt;Li&gt;Pierre

    &lt;/Li&gt;

            </ul>

    </li>

Do you know why the markup is escaped after the second level ? How could I fix that ?

هل كانت مفيدة؟

المحلول

Try {{ children }} instead of {{ children.title }}.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top