Hi folks,
I was working for ThoughtWorks on the forum screen on Melt
(http://weblog.greenpeace.org/melt/) and encountered some problems
using existing template tags to represent a forum thread as a hierarchy
of posts.
I wrote a custom tag that works like this:
{% recurse through get_reply_list as post starting with
forum_post.get_root_post %}
<!-- some content -->
{% ifhaschildren %}
<!-- some content -->
{% childblock %}
<!-- some content -->
{% nextrecursionblock %}
<!-- some content -->
{% endchildblock %}
<!-- some content -->
{% endifhaschildren %}
<!-- some content -->
{% endrecurse %}
You can take a look at the code here:
https://svn.greenpeace.org/viewvc/viewcvs.py/custard/production/trunk/melt/apps/custard/
The tag code is in the templatetags directory and unit tests are here:
https://svn.greenpeace.org/viewvc/viewcvs.py/custard/production/trunk/melt/apps/custard/tests/unit/RecurseNodeTests.py?view=log.
If I've done this right (and not missed a simpler way of implementing
recursion without custom tags) I guess this might be useful to other
Django developers. Is this something the community would be interested
in incorporating in to the Django trunk? If so, what should I do next?
Matt