Django

Comments in Django

Comments in Django

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())

 

Top course recommendations for you

    Python IDLE
    1 hrs
    Beginner
    1.5K+ Learners
    4.71  (21)
    Python vs R
    3 hrs
    Beginner
    1.5K+ Learners
    4.57  (46)
    Highest Paying Tech Jobs
    1 hrs
    Beginner
    2.7K+ Learners
    4.09  (11)
    Threading and Scheduling in Python
    2 hrs
    Beginner
    1.7K+ Learners
    4.58  (38)
    Beautiful Soup
    2 hrs
    Beginner
    1.3K+ Learners
    4.59  (49)
    Java Applications
    1 hrs
    Beginner
    6K+ Learners
    4.47  (125)
    Python List
    1 hrs
    Beginner
    4.3K+ Learners
    4.6  (146)
    Python Classes
    1 hrs
    Beginner
    5.9K+ Learners
    4.51  (166)
    OOPs in Python
    1 hrs
    Beginner
    13.2K+ Learners
    4.39  (753)
    Python Careers
    1 hrs
    Beginner
    5.3K+ Learners
    4.4  (48)