django-comment-system


Namedjango-comment-system JSON
Version 2.10.4 PyPI version JSON
download
home_pagehttps://github.com/mahyar-amiri/django-comment-system
SummaryDjango Comment System, It can be associated with any given model.
upload_time2023-04-15 11:28:06
maintainer
docs_urlNone
authorMahyar Amiri
requires_python
licenseMIT
keywords django comment comment-system django-comment comments comments-system django-comments tailwind tailwindcss ajax
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Django Comment System
=====================

Installation & Configuration
----------------------------

1. Install using pip

   .. code:: shell

      python -m pip install django-comment-system

   or Clone the repository and copy ``comment`` folder and paste in project folder.

   .. code:: shell

      git clone https://github.com/mahyar-amiri/django-comment-system.git


2. Add ``comment.apps.CommentConfig`` to installed_apps in the
   ``settings.py`` file after ``django.contrib.auth``.

   .. code:: python

      # setting.py

      INSTALLED_APPS = [
          'django.contrib.admin',
          'django.contrib.auth',
          'django.contrib.contenttypes',
          'django.contrib.sessions',
          'django.contrib.messages',
          'django.contrib.staticfiles',

          # MY APPS
          'comment.apps.CommentConfig',
      ]

      # your account login url
      LOGIN_URL = 'admin:login'  # or reverse_lazy('admin:login')

      MEDIA_URL = '/media/'
      MEDIA_ROOT = BASE_DIR / 'media'

3. Add ``path('comment/', include('comment.urls')),`` to urlpatterns in
   the ``urls.py`` file.

   .. code:: python

      # urls.py

      from django.urls import path, include

      urlpatterns = [
           path('comment/', include('comment.urls')),
      ]
      urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


4. Connect ``comments`` to target model. In ``models.py`` add the field
   ``comments`` as a GenericRelation field to the required model.

   **NOTE:** Please note that the field name must be ``comments``
   **NOT** ``comment``.

   .. code:: python

      # models.py

      from django.db import models
      from django.contrib.contenttypes.fields import GenericRelation
      from comment.models import Comment

      class Article(models.Model):
          title = models.CharField(max_length=20)
          content = models.TextField()
          # the field name should be comments
          comments = GenericRelation(Comment)

5. Do migrations

   .. code:: shell

      python manage.py migrate

Usage
-----

1. In the template (e.g. post_detail.html) add the following template
   tags where obj is the instance of post model.

   .. code:: html

      {% load comment_tags %}

2. Add the following template tags where you want to render comments.

   .. code:: html

      {% render_comments request obj settings_slug='default-config' %}  {# Render all the comments belong to the passed object "obj" #}

   if your context_object_name is not ``obj`` (e.g article) replace obj
   with context_object_name.

   .. code:: html

      {% render_comments request obj=article settings_slug='default-config' %}

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mahyar-amiri/django-comment-system",
    "name": "django-comment-system",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django comment comment-system django-comment comments comments-system django-comments tailwind tailwindcss ajax",
    "author": "Mahyar Amiri",
    "author_email": "mmaahhyyaarr@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/69/40/cf2f578ac237b074ce0bbe89b9c0ae507272c4433c59459424846888ff17/django-comment-system-2.10.4.tar.gz",
    "platform": null,
    "description": "Django Comment System\n=====================\n\nInstallation & Configuration\n----------------------------\n\n1. Install using pip\n\n   .. code:: shell\n\n      python -m pip install django-comment-system\n\n   or Clone the repository and copy ``comment`` folder and paste in project folder.\n\n   .. code:: shell\n\n      git clone https://github.com/mahyar-amiri/django-comment-system.git\n\n\n2. Add ``comment.apps.CommentConfig`` to installed_apps in the\n   ``settings.py`` file after ``django.contrib.auth``.\n\n   .. code:: python\n\n      # setting.py\n\n      INSTALLED_APPS = [\n          'django.contrib.admin',\n          'django.contrib.auth',\n          'django.contrib.contenttypes',\n          'django.contrib.sessions',\n          'django.contrib.messages',\n          'django.contrib.staticfiles',\n\n          # MY APPS\n          'comment.apps.CommentConfig',\n      ]\n\n      # your account login url\n      LOGIN_URL = 'admin:login'  # or reverse_lazy('admin:login')\n\n      MEDIA_URL = '/media/'\n      MEDIA_ROOT = BASE_DIR / 'media'\n\n3. Add ``path('comment/', include('comment.urls')),`` to urlpatterns in\n   the ``urls.py`` file.\n\n   .. code:: python\n\n      # urls.py\n\n      from django.urls import path, include\n\n      urlpatterns = [\n           path('comment/', include('comment.urls')),\n      ]\n      urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n\n\n4. Connect ``comments`` to target model. In ``models.py`` add the field\n   ``comments`` as a GenericRelation field to the required model.\n\n   **NOTE:** Please note that the field name must be ``comments``\n   **NOT** ``comment``.\n\n   .. code:: python\n\n      # models.py\n\n      from django.db import models\n      from django.contrib.contenttypes.fields import GenericRelation\n      from comment.models import Comment\n\n      class Article(models.Model):\n          title = models.CharField(max_length=20)\n          content = models.TextField()\n          # the field name should be comments\n          comments = GenericRelation(Comment)\n\n5. Do migrations\n\n   .. code:: shell\n\n      python manage.py migrate\n\nUsage\n-----\n\n1. In the template (e.g. post_detail.html) add the following template\n   tags where obj is the instance of post model.\n\n   .. code:: html\n\n      {% load comment_tags %}\n\n2. Add the following template tags where you want to render comments.\n\n   .. code:: html\n\n      {% render_comments request obj settings_slug='default-config' %}  {# Render all the comments belong to the passed object \"obj\" #}\n\n   if your context_object_name is not ``obj`` (e.g article) replace obj\n   with context_object_name.\n\n   .. code:: html\n\n      {% render_comments request obj=article settings_slug='default-config' %}\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django Comment System, It can be associated with any given model.",
    "version": "2.10.4",
    "split_keywords": [
        "django",
        "comment",
        "comment-system",
        "django-comment",
        "comments",
        "comments-system",
        "django-comments",
        "tailwind",
        "tailwindcss",
        "ajax"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c5a1955f2854a05461c537613438d0b9b5e8e1885b944040aa255de61d9e67a",
                "md5": "909e23fc5821e2074e033f0d5f7ac66d",
                "sha256": "34c0e3ed2d52d50604a8b55b93ac8c1f2e3e1a777dc2a2010d99c79e37720d78"
            },
            "downloads": -1,
            "filename": "django_comment_system-2.10.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "909e23fc5821e2074e033f0d5f7ac66d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 969327,
            "upload_time": "2023-04-15T11:28:05",
            "upload_time_iso_8601": "2023-04-15T11:28:05.011371Z",
            "url": "https://files.pythonhosted.org/packages/5c/5a/1955f2854a05461c537613438d0b9b5e8e1885b944040aa255de61d9e67a/django_comment_system-2.10.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6940cf2f578ac237b074ce0bbe89b9c0ae507272c4433c59459424846888ff17",
                "md5": "0bf879b3d7d6058200cff32ff45a9a44",
                "sha256": "8621e1c3e481379f157254c9a0080f8d1d80ea2b0272a5794c611bb290b961d1"
            },
            "downloads": -1,
            "filename": "django-comment-system-2.10.4.tar.gz",
            "has_sig": false,
            "md5_digest": "0bf879b3d7d6058200cff32ff45a9a44",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 957949,
            "upload_time": "2023-04-15T11:28:06",
            "upload_time_iso_8601": "2023-04-15T11:28:06.786184Z",
            "url": "https://files.pythonhosted.org/packages/69/40/cf2f578ac237b074ce0bbe89b9c0ae507272c4433c59459424846888ff17/django-comment-system-2.10.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-15 11:28:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mahyar-amiri",
    "github_project": "django-comment-system",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-comment-system"
}
        
Elapsed time: 0.89758s