[Answer]-Creating nested structure xml with django

0๐Ÿ‘

โœ…

I figure out!

So regroup could be nested and my code should be looks like something like this:

{% regroup datas by pagenum as pagenum_list %}
{% for pagenum in pagenum_list %}
<TAGS>
  <PAGE page="{{pagenum.grouper}}">
    {% regroup pagenum.list by parenttag as parenttag_list %}
    {% for parenttag in parenttag_list %}
    <PARENT parent="{{parenttag.grouper}}">
      {% regroup parenttag.list by tag as tag_list %}
      {% for tag in tag_list %}
      <TAG>{{tag.grouper}}</TAG>
      {% endfor %}
    </PARENT>
    {% endfor %}
  </PAGE>
</TAGS>
{% endfor %}
๐Ÿ‘คShun

1๐Ÿ‘

either have your data structure better ready for rendering by grouping parents or implement a more advanced solution like Can I use XSLT in Django?

๐Ÿ‘คGuy Gavriely

Leave a comment