Its easy enough if you're using the template tags. Just refer to the documentation and you should be set.
First, remember to load the comments tags.
1.
{
%
load comments
%
}
To get the number of comments for an object:
1.
{
%
get_comment_count
for
entry as comment_count
%
}
Or quickly display all the comments:
1.
{
%
render_comment_list
for
whatever_object
%
}
If you want more control displaying the comments:
1.
{
%
get_comment_list
for
object as comment_list
%
}
2.
3.
{
%
for
comment
in
comment_list
%
}
4.
...
5.
{
%
endfor
%
}
However if you're trying to get that info in the code, good luck.
1.
from
django.contrib.comments.models
import
Comment
2.
from
django.contrib.sites.models
import
Site
1.
site
=
Site.objects.get_current()
2.
comments
=
Comment.objects.for_model(
self
).filter(site
=
site, is_public
=
True
, is_removed
=
False
)
[ Source ]