Can someone see what I am doing wrong here? What am I missing?
# works
{% get_comment_count for app.somemodel object_pk as comment_count %}
{% get_comment_count for model as comment_count %}
# Throws error: "Caught AttributeError while rendering: 'str' object has no attribute '_meta'"
{% render_comment_list for app.somemodel %}
{% render_comment_form for app.somemodel %}
# Gives an empty form and empty list
{% render_comment_list for model %}
{% render_comment_form for model %}
the view:
# view.py
from app.models import SomeModel
def some_view(request):
return render_to_response("app/some_template.html", {'model': SomeModel})
I've never used the comments framework, but I'm gonna go ahead and suggest passing in a model instance -- how can you render a comment form or list for a model Class?
Comments have a generic relation towards a model and its ID. You can't comment on a model class.
http://docs.djangoproject.com/en/dev/ref/contrib/comments/#displaying-the-comment-post-form
def some_view(request):
# pass in an instance, not a class, if you want to render a comment form
return render_to_response("app/some_template.html", {'model': SomeModel.objects.latest('id')})