Reputation: 5010
I have a Django application with two models: the first one is django.contrib.auth.User
and the second one is Product
, created by me.
For every product I would add the comments, so every User registered can insert a comment for every product.
I've see there's django.contrib.comments
, but probably it's for the blog-like sites, where's every user can leave a comment also if they're not registered. I would a comment form with only the textarea for write the comment and the user is automatically setted to request.user
.
Should I write the comments system from scratch?
Upvotes: 4
Views: 3969
Reputation: 13016
What you've described sounds extremely simple, and perfect for Django's in-built comment app. Just because it allows anonymous users to comment doesn't mean that's a requirement, you can easily prevent anonymous users from commenting by simply not displaying the comment form for non-authenticated users.
You should run through this example of using the in-built comment app: https://docs.djangoproject.com/en/dev/ref/contrib/comments/example/
I think you'll find it does everything you need, has additional features you might not have thought of (spam protection) and will save you a lot of time building something from scratch.
Upvotes: 5
Reputation: 3176
The built-in Django comments module is for any model that you want to enable comments on. See here: https://docs.djangoproject.com/en/1.3/ref/contrib/comments/
Upvotes: 0