Hi All,
I'm looking for advice on the best way to do the following.
I'm creating a simple message board app and would like to be able to
recursively display threads to an unlimited depth. The existing php
version recursively selects and displays the child threads until there
are no more (not very high traffic so the inefficiency isn't a major
problem).
I've setup my model as follows (simplified):
class Topic(meta.Model):
parent = meta.ForeignKey('self', related_name="parents", blank=True)
name = meta.CharField("Name", maxlength=200, blank=True)
email = meta.CharField("Email", maxlength=200, blank=True)
subject = meta.CharField("Subject", maxlength=200)
body = meta.TextField("Body")
stamp = meta.DateTimeField('Date Published', auto_now_add=True)
and the display I'd like to achieve is something along the lines of
first topic
---reply
-------reply
----------reply
----------reply
---reply
second topic
---reply
---reply
third topic
Also, is there a way for me to select all root level topics? (eg. where
there is no parent), I've tried all the methods I could think of such
as parent_id__exact=0 and similar ones though haven't been able to work
out a way short of cycling through the returned records and filtering
there.
- Recursive templates? Milton Waddams
- Re: Recursive templates? EspenGrindhaug
- Re: Recursive templates? [EMAIL PROTECTED]