Django 1.1 - comments - 'render_comment_form' returns TemplateSyntaxError

I want to simply render a built-in comment form in a template, using Django's builtin commenting module, but this returns a TemplateSyntaxError Exception.

I need help debugging this error, please, because after googling and using the Django API reference, I'm still not getting any farther.


This is the template '_post.html'[shortened]:

<div id="post_{{ }}">
    <a href="{% url post %}">{{ object.title }}</a>
    <small>{{ object.pub_date|timesince }} ago</small>
    {{ object.body }}
    {% load comments %}
    {% get_comment_count for object as comment_count %}
    <p>{{ comment_count }}</p>
    <!-- Returns 0, because no comments available  -->
    {% render_comment_form for object %}
    <!-- Returns TemplateSyntaxError -->

This is the Exception output, when rendering:

Caught an exception while rendering: Reverse for 'django.contrib.comments.views.comments.post_comment'
with arguments '()' and keyword arguments '{}' not found.1  
{% load comments i18n %}
        <form action="{% comment_form_target %}" method="post">
          {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
          {% for field in form %}
            {% if field.is_hidden %}
              {{ field }}
            {% else %}
          {% if field.errors %}{{ field.errors }}{% endif %}
            {% if field.errors %} class="error"{% endif %}
            {% ifequal "honeypot" %} style="display:none;"{% endifequal %}>
            {{ field.label_tag }} {{ field }}


queryset = {'queryset': Post.objects.all(),
            'extra_context' : {"tags" : get_tags}
urlpatterns = patterns('django.views.generic.list_detail',
    url('^$',                           'object_list',      queryset,
    url('^blog/(?P<object_id>\d+)/$',   'object_detail',    queryset,


urlpatterns = patterns('',
    (r'', include('posts.urls')),
    (r'^comments/$', include('django.contrib.comments.urls')),


I had the same exact problem, render_comment_form template tag was triggering it.

The issue is certainly with your URL config, you had it set the same way i did:

(r'^comments/$', include('django.contrib.comments.urls'))

The correct way is to remove the '$' after 'comments/':

(r'^comments/', include('django.contrib.comments.urls'))

Otherwise django can't properly include all necessary urls under the path comments/...

Hope this helps.

The error message is indicated that it can't find a reverse url for:


So basically something isn't configured right in your urls. Without being able to see more of how things are setup it's difficult to know exactly what.

Maybe try re-ordering the urls pattern includes in your, to force the django comments urls to the top?

I had this same problem today. I was referencing a view in that I hadn't created yet.


As part of working out which URL names map to which patterns, the reverse() function has to import all of your URLconf files and examine the name of each view. This involves importing each view function. If there are any errors whilst importing any of your view functions, it will cause reverse() to raise an error, even if that view function is not the one you are trying to reverse.

Make sure that any views you reference in your URLconf files exist and can be imported correctly. Do not include lines that reference views you haven't written yet, because those views will not be importable.

This error is saying that it found the view django.contrib.comments.views.comments.post_comment

but no args () or kwargs{} were passed.

Its not passing a value for into the url.

Take out the url tag and see if the id of the <div id="post_{{}}"> reflects a proper

Need Your Help

TVirtualStringTree - resetting non-visual nodes and memory consumption

delphi c++builder vcl virtualtreeview

I have an app that loads records from a binary log file and displays them in a virtual TListView. There are potentially millions of records in a file, and the display can be filtered by the user, ...

Python: generator expression vs. yield

python yield generator

In Python, is there any difference between creating a generator object through a generator expression versus using the yield statement?