{ "info": { "author": "Radico", "author_email": "mus.radi85@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-comments-dab App - v1.3.0\n================================\n\n**dab stands for Django-Ajax-Bootstrap**\n\n``django-comments-dab`` is a commenting application for Django-powered\nwebsites.\n\nIt allows you to integrate commenting functionality with any model you\nhave e.g. blogs, pictures, etc\u2026\n\n*List of actions you can do:*\n\n 1. Post a new comment. (Authenticated)\n\n 2. Reply to an existing comment. (Authenticated)\n\n 3. Edit a comment you posted. (Authenticated)\n\n 4. Delete a comment you posted. (Authenticated)\n\n\n- All actions are done by ajax - JQuery 3.2.1\n\n- Bootstrap 4.1.1 is used in comment templates for responsive design.\n\n\nInstallation\n------------\n\n\nRequirements:\n~~~~~~~~~~~~~\n\n 1. **django>=2.1.5**\n 2. **django-widget-tweaks==1.4.2**\n 3. **djangorestframework==3.8.2** # for API Framework\n 4. **Bootstrap 4.1.1**\n 5. **jQuery 3.2.1**\n\n\nInstallation:\n~~~~~~~~~~~~~\n\n\nInstallation is available via ``pip``\n\n::\n\n $ pip install django-comments-dab\n\n\nor via source on github\n\n::\n\n $ git clone https://github.com/radi85/Comment.git\n $ cd Comment\n $ python setup.py install\n\n\nSettings and urls:\n~~~~~~~~~~~~~~~~~~\n\n 1. Add ``comment`` to your installed_apps in your ``settings.py`` file. It should be added after ``django.contrib.auth``. and,\n 2. Make sure that ``widget-tweaks`` is already included in installed_apps as well.\n 3. ``LOGIN_URL`` shall be defined in the settings.\n\nyour ``settings.py`` should look like the following:\n\n.. code:: python\n\n INSTALLED_APPS = (\n 'django.contrib.admin',\n 'django.contrib.auth',\n ...\n 'widget_tweaks',\n 'comment',\n 'rest_framework', # for API Framework\n ..\n )\n\n LOGIN_URL = 'login' # or your actual url\n\nIn your urls.py:\n\n.. code:: python\n\n urlpatterns = patterns(\n path('admin/', admin.site.urls),\n path('comment/', include('comment.urls')),\n ...\n path('api/', include('comment.api.urls')), # for API Framework\n ...\n )\n\nMigrations:\n~~~~~~~~~~~\n\nMigrate comment app:\n\n::\n\n $ python manage.py migrate comment\n\n\n\nSetup\n-----\n\nStep 1\n~~~~~~\n\nIn your models.py add the field ``comments`` (Please note that field name\nmust be ``comments`` not ``comment``) to the model for which comments\nshould be added (e.g. Post) and **the appropriate imports** as shown below:\n\n.. code:: python\n\n from django.contrib.contenttypes.fields import GenericRelation\n from comment.models import Comment\n\n class Post(models.Model):\n author = models.ForeignKey(User)\n title = models.CharField(max_length=200)\n body = models.TextField()\n # the field name should be comments\n comments = GenericRelation(Comment)\n\nStep 2\n~~~~~~\n\n``get_comments`` *tag uses 2 positional and 3 optional args*:\n\n 1. The instance of the model. (**positional**)\n 2. Request object. (**positional**)\n 3. oauth. (optional - Default is false)\n 4. paginate. (optional - Default is false)\n 5. cpp (number of Comments Per Page - Default is 10)\n\n\n1. Basics usage:\n^^^^^^^^^^^^^^^^\n\n``include_static`` this tag will include required jquery and javascript file,\nif you already use jquery please make sure it is not the slim version which doesn't support ajax.\n``include_bootstrap`` tag is for bootstrap-4.1.1, if it\u2019s already included\nin your project, get rid of this tag.\n\nIn your template (e.g. post-detail.html) add the following template tags where object is the instance of post model.\n\n.. code:: python\n\n {% load comment_tags %} # Loading the template tag\n {% get_comments object request %} # Include all the comments belonging to a certain object\n\n\n**Include static files:**\n\nThe comment app has three template tags for static files that the app requires.\nThese tags need to be included in the end of your base template.\n\n\n- **Case 1:** You already have jQuey in your project then the following tags shall be included below jQuery file:\n\n.. code:: html\n\n \n\n {% load comment_tags %} # Loading the template tag\n\n {% include_static %} # Include comment.js file only.\n {% include_bootstrap %} # Include bootstrap 4.1.1 - remove this line if BS 4.1.1 is already used in your project\n\n\n- **Case 2:** You don't have jQuery in your project then the following tags shall be included:\n\n.. code:: html\n\n {% load comment_tags %} # Loading the template tag\n\n {% include_static_jquery %} # Include mini jQuery 3.2.1 and required js file.\n {% include_bootstrap %} # Include bootstrap 4.1.1 - remove this line if BS 4.1.1 is already used in your project\n\n\n2. Advanced usage:\n^^^^^^^^^^^^^^^^^^\n\n **1. Add pagination:**\n\n To add pagination to your comments, you need to pass two variables to the ``get_comments`` tag.\n ``paginate`` must be set to ``True`` and set ``cpp`` var (number of comments per page - default is 10) to the desired number of comments per page.\n e.g. If you would like to have 5 comments per page, the ``get_comments`` tag should look like this:\n\n .. code:: python\n\n {% load comment_tags %} # Loading the template tag\n {% get_comments object request paginate=True cpp=5 %} # Include all the comments belonging to a certain object\n {% include_bootstrap %} # Include bootstrap 4.1.1 - remove this line if BS 4.1.1 is already used in your project\n {% include_static %} # Include jQuery 3.2.1 and required js file\n\n\n\n **2. Integrate existing profile app with comments app:**\n\n If you have a profile model for the user and you would like to show the\n profile image on each comment, you need to do these two steps:\n\n - Declare ``PROFILE_APP_NAME`` and ``PROFILE_MODEL_NAME`` variables in your ``settings.py`` file.\n (e.g if user profile app is called ``accounts`` and profile model is called ``UserProfile``)\n Update your ``settings.py`` as follows:\n\n .. code:: python\n\n PROFILE_APP_NAME = 'accounts'\n PROFILE_MODEL_NAME = 'UserProfile' # letter case insensitive\n\n\n\n - Make sure that ``get_absolute_url`` method is defined in your profile model.\n Update your ``user profile model`` as follows:\n\n .. code:: python\n\n from django.urls import reverse\n\n class UserProfile(models.Model):\n user = models.OneToOneField(User, on_delete=models.CASCADE)\n ...\n ...\n\n # this method must be defined for appropriate url mapping in comments section\n def get_absolute_url(self):\n return reverse('profile_url_name')\n\n\nWeb API\n-------\n\ndjango-comments-dab uses django-rest-framework to expose a Web API that provides\ndevelopers with access to the same functionalities offered through the web user interface.\n\nThere are 5 methods available to perform the following actions:\n\n\n 1. Post a new comment. (Authenticated)\n\n 2. Reply to an existing comment. (Authenticated)\n\n 3. Edit a comment you posted. (Authenticated)\n\n 4. Delete a comment you posted. (Authenticated)\n\n 5. Retrieve the list of comments and associated replies to a given content type and object ID.\n\nThese actions are explained below.\n\nSetup:\n~~~~~~\n\nTo integrate the comment API in your content type (e.g Post model), in ``serializers.py``\nfor the Post model add comments field as shown below:\n\n\n.. code:: python\n\n from rest_framework import serializers\n from comment.models import Comment\n from comment.api.serializers import CommentSerializer\n\n\n class PostSerializer(serializers.ModelSerializer):\n\n comments = serializers.SerializerMethodField()\n\n class Meta:\n model = Post\n fields = ('id',\n ...\n ...\n 'comments')\n\n def get_comments(self, obj):\n comments_qs = Comment.objects.filter_by_object(obj)\n return CommentSerializer(comments_qs, many=True).data\n\n\nBy default the image field from profile models will be included inside user object\nin JSON response. This can only happen if the profile attributes mentioned early are\ndefined in your ``settings.py``. In case you would like to serialize more fields from profile models\nyou need to explicitly declare the ``COMMENT_PROFILE_API_FIELDS`` tuple inside your ``settings.py``\nas follows:\n\n\n.. code:: python\n\n PROFILE_APP_NAME = 'accounts'\n PROFILE_MODEL_NAME = 'userprofile'\n # the field names below must be similar to your profile model fields\n COMMENT_PROFILE_API_FIELDS = ('display_name', 'birth_date', 'image')\n\n\nComment API actions:\n~~~~~~~~~~~~~~~~~~~~\n\n **1- Retrieve the list of comments and associated replies to a given content type and object ID:**\n\n This action can be performed by providing the url with data queries related to the content type.\n\n Get request accepts 3 params:\n\n\n - ``type``: is the model name of the content type that have comments associated with it.\n - ``id``: is the id of an object of that model\n\n\n\n\n For example if you are using axios to retrieve the comment list of second object (id=2) of a model (content type) called post.\n you can do the following:\n\n\n .. code:: javascript\n\n axios ({\n method: \"get\",\n url: \"http://127.0.0.1:8000/api/comments/?type=post&id=2\",\n })\n\n\n\n **2- Post a comment and reply to an existing comment:**\n\n Authorization must be provided in the headers.\n\n The data queries provided with the url are as above with one more parameter:\n\n - ``parent_id``: is 0 or **NOT PROVIDED** for parent comments and for reply comments must be the id of parent comment\n\n\n Example: posting a parent comment\n\n .. code:: javascript\n\n axios({\n method: \"post\",\n url: \"http://127.0.0.1:8000/api/comments/create/?type=post&id=2&parent_id=0\",\n data: {\n content: \"Hello comments\"\n },\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n Authorization: `Token ${token}`\n }\n })\n\n\n **3- Update a comment:**\n\n Authorization must be provided in the headers.\n\n The url has no data queries in this action.\n\n This action requires the ``comment id`` that you want to update:\n\n\n .. code:: javascript\n\n axios({\n method: \"put\",\n url: \"http://127.0.0.1:8000/api/comments/1\",\n data: {\n content: \"Update comment number 1 (id=1)\"\n },\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n Authorization: `Token ${token}`\n }\n })\n\n\n **4- Delete a comment:**\n\n Authorization must be provided in the headers.\n\n The url has no data queries in this action.\n\n This action requires the ``comment id`` that you want to delete:\n\n\n .. code:: javascript\n\n axios({\n method: \"delete\",\n url: \"http://127.0.0.1:8000/api/comments/1\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n Authorization: `Token ${token}`\n }\n })\n\n\n\nStyle Customize:\n----------------\n\n1- Bootstrap classes:\n~~~~~~~~~~~~~~~~~~~~~\n\nBS class used in the default template can be now customized from within your templates directory as follows:\n\n 1. Create ``comment`` folder inside your templates directory.\n\n 2. Create new template file ``.html`` with the same name of the default template you wish to override BS classes in it.\n\n\nfor example to override the BS classes of comment and reply btn do the following:\n\ncreate ``templates/comment/create_comment.html``\n\n.. code:: python\n\n {% extends \"comment/create_comment.html\" %}\n\n {% block post_btn_cls %}\n btn btn-primary btn-block btn-sm\n {% endblock post_btn_cls %}\n\n`Read the Doc`_ for more info about template names and block tags name.\n\n.. _`Read the Doc`: https://django-comment-dab.readthedocs.io/\n\n\n2- CSS file:\n~~~~~~~~~~~~\n\nIf you want to customize the default style of comments app , you can do the following steps:\n\n 1. Create a ``comment.css`` file inside your ``static/css`` directory.\n\n 2. The new created file will override the original file used in the app.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/radi85/Comment", "keywords": "comments comment development", "license": "MIT", "maintainer": "Radi Mustafa", "maintainer_email": "mus.radi85@gmail.com", "name": "django-comments-dab", "package_url": "https://pypi.org/project/django-comments-dab/", "platform": "", "project_url": "https://pypi.org/project/django-comments-dab/", "project_urls": { "Documentation": "https://django-comment-dab.readthedocs.io/index.html", "Homepage": "https://github.com/radi85/Comment", "Source Code": "https://github.com/radi85/Comment" }, "release_url": "https://pypi.org/project/django-comments-dab/1.3.0/", "requires_dist": null, "requires_python": "", "summary": "Django Comment Framework app. It can be associated with any given model.", "version": "1.3.0" }, "last_serial": 4695330, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "389cee15f77aeb2b47b925e3493ca963", "sha256": "78d45d89e115d5d28605fdd55298460a613b2fdcdd5a80c25a5fc97e15646e1b" }, "downloads": -1, "filename": "django-comments-dab-1.0.0.tar.gz", "has_sig": false, "md5_digest": "389cee15f77aeb2b47b925e3493ca963", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 64062, "upload_time": "2018-09-01T20:28:34", "url": "https://files.pythonhosted.org/packages/01/d9/4a269ab87323affcfda6182657e9ee472aa9240514f1195b1e6abd6495f9/django-comments-dab-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "8ac67b1c86f04c2f8fe666665df31b9f", "sha256": "09060e74e62f1c5f416c34469044239b14b94e91775ed720b82447d025bb0a95" }, "downloads": -1, "filename": "django-comments-dab-1.0.1.tar.gz", "has_sig": false, "md5_digest": "8ac67b1c86f04c2f8fe666665df31b9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 68666, "upload_time": "2018-09-03T14:55:15", "url": "https://files.pythonhosted.org/packages/00/3c/6efd0a73c8298f7aa3ac6d6e0433358e30d40b485ca3fb3614c2be56fea1/django-comments-dab-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "c8f482f6b91672be6ddaaba5ecb717b6", "sha256": "d0f36f5777ab43108179abde576c103b8ec3dce099db3c20b8ad2a970c96e044" }, "downloads": -1, "filename": "django-comments-dab-1.1.0.tar.gz", "has_sig": false, "md5_digest": "c8f482f6b91672be6ddaaba5ecb717b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 69751, "upload_time": "2018-09-05T12:29:13", "url": "https://files.pythonhosted.org/packages/1a/c3/cdaefade13800c211750185d4e7aafa81926d4415d62800b7b059f7736d7/django-comments-dab-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "414d88227d9aadedd478fe2b3db01bbe", "sha256": "5092e1317588ac663320eebef8497998b17a483f7f94cf4ff10ce3cf5c2b32b1" }, "downloads": -1, "filename": "django-comments-dab-1.1.1.tar.gz", "has_sig": false, "md5_digest": "414d88227d9aadedd478fe2b3db01bbe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 70209, "upload_time": "2018-09-08T14:13:47", "url": "https://files.pythonhosted.org/packages/3e/e3/2917d535d693777178b5f2c7a05dd5a8f9871763df3697d454fc6a356a6c/django-comments-dab-1.1.1.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "77304556e1fd62547610f5de62f6cef4", "sha256": "ff7680070324f18a267bde19c6bcf08b1cc320e7567583aa8e6950337e213b5b" }, "downloads": -1, "filename": "django-comments-dab-1.2.0.tar.gz", "has_sig": false, "md5_digest": "77304556e1fd62547610f5de62f6cef4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 73035, "upload_time": "2018-10-07T14:31:41", "url": "https://files.pythonhosted.org/packages/b0/f3/565779fa8e136112ae41841a9435250849ced8c808b47c22de4f74fe54fb/django-comments-dab-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "ce3cbade454e337fe34b7ffc8ce20bf8", "sha256": "0feca15f9d8947e1231c6f30f43e6528ad64fbf6b6357151671cd28ec31e87ba" }, "downloads": -1, "filename": "django-comments-dab-1.2.1.tar.gz", "has_sig": false, "md5_digest": "ce3cbade454e337fe34b7ffc8ce20bf8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 88008, "upload_time": "2018-10-10T14:43:35", "url": "https://files.pythonhosted.org/packages/b9/30/5b1d83843ee9d9e0cced9bc08009a37b789f9a6c26334085d6c98e753d66/django-comments-dab-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "df55b0635e07264d7f2d410b509b2351", "sha256": "56b081805280ff619c1b84b6822078ff29694c70a6b7913641661f1ba8e97fc4" }, "downloads": -1, "filename": "django-comments-dab-1.2.2.tar.gz", "has_sig": false, "md5_digest": "df55b0635e07264d7f2d410b509b2351", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 88913, "upload_time": "2018-10-27T13:12:43", "url": "https://files.pythonhosted.org/packages/0f/bc/25fe0d3c413f162bc291ad9c76115473c4877be11ff67157c83e08b3df53/django-comments-dab-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "314d1df71fcd71b5bcc088e9aa13938d", "sha256": "bba9e18c1af4766ac8f7dc48d066b7ad151a1a118c2b72949a76ae59240ef9cb" }, "downloads": -1, "filename": "django-comments-dab-1.2.3.tar.gz", "has_sig": false, "md5_digest": "314d1df71fcd71b5bcc088e9aa13938d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 89227, "upload_time": "2018-11-07T17:30:03", "url": "https://files.pythonhosted.org/packages/b8/f4/081786c0e8c1b74ff2141438e2bfe19ecd1be276b1056d8673771ce3686d/django-comments-dab-1.2.3.tar.gz" } ], "1.2.4": [ { "comment_text": "", "digests": { "md5": "92bf37fb69399552d495ce97e1feefc8", "sha256": "0348ecf671f3011ca54c3035d3bdc51391642ab905e463b1d6a401494b498488" }, "downloads": -1, "filename": "django-comments-dab-1.2.4.tar.gz", "has_sig": false, "md5_digest": "92bf37fb69399552d495ce97e1feefc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 91773, "upload_time": "2018-11-11T14:01:08", "url": "https://files.pythonhosted.org/packages/05/a2/37c5a885e1ab0d71b9109268770a03554b918c9e893ec6f0dbafbfb0f97c/django-comments-dab-1.2.4.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "da14f1604f1ca471bd6531a0fa3d0168", "sha256": "47c51b6cbf3a71cce49dd450e5c57231cb54f2bc7bc6f4002848dc5b7d9aa15b" }, "downloads": -1, "filename": "django-comments-dab-1.3.0.tar.gz", "has_sig": false, "md5_digest": "da14f1604f1ca471bd6531a0fa3d0168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 91996, "upload_time": "2019-01-14T18:23:11", "url": "https://files.pythonhosted.org/packages/c7/8d/1014b1e1ea8cf433c04f499048aa076623e7a3571d652fff9d44adb54ffe/django-comments-dab-1.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "da14f1604f1ca471bd6531a0fa3d0168", "sha256": "47c51b6cbf3a71cce49dd450e5c57231cb54f2bc7bc6f4002848dc5b7d9aa15b" }, "downloads": -1, "filename": "django-comments-dab-1.3.0.tar.gz", "has_sig": false, "md5_digest": "da14f1604f1ca471bd6531a0fa3d0168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 91996, "upload_time": "2019-01-14T18:23:11", "url": "https://files.pythonhosted.org/packages/c7/8d/1014b1e1ea8cf433c04f499048aa076623e7a3571d652fff9d44adb54ffe/django-comments-dab-1.3.0.tar.gz" } ] }