honzakral / django-threadedcomments

django-threadedcomments is a simple yet flexible threaded commenting system for Django.
BSD 3-Clause "New" or "Revised" License
622 stars 165 forks source link

threadedcomments_tags in Python (API)? #113

Open yuis-ice opened 2 years ago

yuis-ice commented 2 years ago

I have {% get_comment_list for data.post as comment_list %} in a template html. This loads the comments and returns the object so loop over it to get and render its user or comment content and so on.

But what I want to do is use the tag from Python in views. Because I'm working on a client side ajax API that requests a list of comments, so I want to get the comment objects through a view.

I found that the line def get_comment_list(parser, token): is doing the thing, but how can I pass or construct that parser and token object from a view, without going through a template html?

Thanks for your help.