Users of our e-commerce application can now sign up for accounts, browse our product catalog, add items to a shopping cart, and submit payments through the checkout system. To complete the circle, we will build simple, quick customer reviews using Django's built-in comments framework.
The comments framework is designed as a general purpose tool to attach comments to any Django object. To use it for customer reviews, we can attach comments to our Product
model. Doing this is very easy, in fact it is basically automatic—just another convenience of working in Django.
To implement comments you only need to do two things: add django.contrib.comments
to your INSTALLED_APPS
project setting and add django.contrib.comments.urls
to your root URL patterns under the comments/
URL. Once you've done this, you can begin using comments in your templates.
For our product detail page, we will add a section for user reviews and a form for customers to complete their own review. All...