Fun with ones and zeros



Django comments

I've tried adding a comments feature to this site, using the stock django.contrib.comments application, mostly following the instructions from the Django Wiki, and also using James Bennet's comment-utils described here.

The Wiki is pretty thorough, but one thing I think it missed was that in the template for displaying comments, you should have a

<a name="c{{ comment.id }}" />

Near the beginning of where your comment starts being output, so the standard get_absolute_url() method for the FreeComment model has a place to point to.

A couple things that were not really talked about in the comment-utils docs were where to get the Python Akismet library, and the need for a comment_utils/comment_notification_email.txt template if you want e-mail notifications. I ended up with something simple like:

Comment: http://127.0.0.1{{ comment.get_absolute_url }}
From: {{ comment.person_name }}

-----
{{ comment.comment }}
-----

Admin: http://127.0.0.1/admin/comments/freecomment/{{comment.id}}/

I'm a bit skeptical about how well the Akismet spam-filtering service will work, but we'll see how it goes.

posted: Saturday, 19 January 2008 15:14 | tags: django


Comments

#1 Barryp commented, on May 2, 2008 at 8:56 a.m.:

Just to comment on my own entry...Akismet does seem to be doing a pretty good job. Several spammers have tried posting here, but Akismet keeps them from being flagged as public, so they don't get shown.

#2 Luis Rausseoa commented, on August 24, 2008 at 7:53 a.m.:

Muy bueno el articulo

Post a comment








A Django site.

Valid XHTML 1.0 Transitional