Search code examples
django-admindjango-comments

Why I can't get django_comments in the admin


The version of django is 1.10 and Python version is 2.7.6 .After I have migrate and create table,it showed that I have migrated the django_comments.When I get into my admin,I can't find the django_comments app. By the way,I have installed django_comments.And I can use it normally on the front side.


Solution

  • Built-in apps like django.contrib.sites automatically registers its model in the admin. I believe that since django_comments is now a separated app from the django core, you'll have to register the model in the admin to see it.

    If you've successfully migrated django_comments and used it, then I think you're just missing the admin registration.

    I started a brand new Django project to test this out, and I got to see the Comments in my admin.

    Using Python 2.7.12...

    • pip install django
    • pip install django-contrib-comments
    • django-admin startproject main
    • Put my project main in the INSTALLED_APPS
    • Followed steps 1 to 5 in the quickstart guide for django-contrib-comments (https://django-contrib-comments.readthedocs.io/en/latest/quickstart.html)
    • python manage.py migrate
    • Included the following code in main/admin.py (create the file if it's not there):

      from django_comments.models import Comment
      
      admin.site.register(Comment)
      
    • python manage.py runserver

    • Ran browser and logged into admin
    • Comment is there

    enter image description here