有人能看到我在这里做错了吗?我错过了什么?
# 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 %}
风景:
# view.py
from app.models import SomeModel
def some_view(request):
return render_to_response("app/some_template.html", {'model': SomeModel})