Actually, on the first one, I would just define it in the model. So if you have Blog.entry, under entry there would be
def get_comment_count(self): do stuff and in the template, you'd just say entry.get_comment_count On Apr 13, 2:01 am, fuxter <fuxt...@gmail.com> wrote: > yeap, that's another way this could be done. incrementing > comments_count on signal. > actually, i'm inclined to your first method, since it's seems easier > for my to accomplish. i'm also considering writing a templatetag just > for the practice. nevere have i need to write templatetag till now. > > thank you for sharing your thoughts. > > On 13 апр, 00:03, "bax...@gretschpages.com" <mail.bax...@gmail.com> > wrote: > > > > > I'm not saying it's the best way, but I would either define my own > > get_comment_count in my application's models.py that looped through > > the ojbects comments (and their comments) to get an accurate count. > > > OR > > > I would store comment_count locally on the object and send a signal > > when a comment is saved, something like (and excuse the pseudo-code) > > if this.parent = object or this.parent.parent = object: comment.count > > += 1 > > > On Apr 12, 2:18 pm, fuxter <fuxt...@gmail.com> wrote: > > > > hey everyone, > > > i'm a young django user and need some advice or opinions on the way of > > > general use. > > > > in my application (blog-like site) i have objects and they can have > > > comments. i also decided to implement limited comment reply feature. > > > so the objects can have comments, and those comments can have comments > > > as well. it turn out to be one level nested comments. comments for > > > comments can't have replies. > > > > at this point i'm stuck with get_comment_count template tag that > > > returns only object's comments count, naturally. and i need to count > > > all the replies altogether. > > > > so my question is how would you do that? should i add a method to > > > commented object that would count all the replies? maybe i could hack > > > the comments/templatetags framework? or should i write my own > > > templatetag? > > > > i guess all the options are pretty usable and they don't cross the > > > django way, which is very liberal. i just wanted to know you opinion, > > > what would you prefer? > > > > ps: pardon my russian =) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.