[Django]-Django 1.1 – comments – 'render_comment_form' returns TemplateSyntaxError

6πŸ‘

βœ…

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.

1πŸ‘

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


   django.contrib.comments.views.comments.post_comment

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 urls.py, to force the django comments urls to the top?

1πŸ‘

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

From http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse

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.

1πŸ‘

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 object.id into the url.

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

Leave a comment