Comments by Django

I have a Django application with two models: the first is django.contrib.auth.User , and the second is a Product created by me.

For each product, I would add comments, so each registered user can insert a comment for each product.

I see django.contrib.comments there, but this is probably for blog-like sites where each user can leave a comment as well if they are not registered. I would write a comment form only for textarea to record a comment, and the user is automatically configured to request.user .

Should I write a comment system from scratch?

+4
source share
2 answers

What you described sounds very simple and perfect for Django's inline commentary. Just because it allows anonymous users to comment does not mean that this is a requirement; you can easily prevent anonymous users from commenting by simply not displaying a comment form for unauthenticated users.

You should run this example using the built-in comments application: https://docs.djangoproject.com/en/dev/ref/contrib/comments/example/

I think you will find that it does everything that you need, has additional functions that you might not have thought of (spam protection), and will save you a lot of time creating something from scratch.

+5
source

Django's built-in comment module is for any model that you want to include comments on. See here: https://docs.djangoproject.com/en/1.3/ref/contrib/comments/

0
source

All Articles