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?
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 thatparser
andtoken
object from a view, without going through a template html?Thanks for your help.