Skip to main content

This adds authentication to django.contrib.comments.

Project description


To make sure no bad hacker adds a comment with no authentication, you have to install a small app called django-contrib-comments-auth:

pip install django-contrib-comments-auth

Add it to the INSTALLED_APPS:

# ...

Add these lines to your root

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

It must be before the django.contrib.comments.urls-directive and have the same prefix.

The template for the comment-form could look like:

    {% load comments %}
    {% if request.user.is_authenticated %}
    <h2>Leave a comment</h2>
    {% get_comment_form for object as form %}
<form action="{% comment_form_target %}" method="POST">
    {{ form.comment }}
    {{ form.honeypot }}
    {{ form.content_type }}
    {{ form.object_pk }}
    {{ form.timestamp }}
    {{ form.security_hash }}
    <input type="submit" value="Add comment" id="id_submit" />
    {% else %}
    <h1>Display login form or link to login page!</h1>
    {% endif %}

Please make sure to have these two lines in your MIDDLEWARE_CLASSES:

    # ...



Release date: 12-Aug-2010

  • Added news to the NEWS.txt.


Release date: 12-Aug-2010

  • First untested version published.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-contrib-comments-auth, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django-contrib-comments-auth-0.1.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page