The comments framework in Django is very useful to attach comments to any model in the app. There are some settings that you need to store in the settings.py file of your Django project:
Add the details in your INSTALLED_APPS option in the settings.py file:
INSTALLED_APPS += (‘django.contrib.sites’, ‘django.contrib.comments’,)
Let’s see how you can add comments in Views:
from django.http import HttpResponse
from django.template import loader
def test-comment(request):
temp = loader.get_template(‘temp.html’)
#Here the template is loaded
#This is a comment
#by using hash, you can add comments in django
return HttpResponse(temp.render())