Skip to content

Commit

Permalink
update version to 1.6.0
Browse files Browse the repository at this point in the history
- Update docs
- Update setup.py
  • Loading branch information
rmustafa-cocus committed Jun 7, 2020
1 parent f1b32d1 commit b56a6be
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 33 deletions.
98 changes: 84 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.. image:: https://badge.fury.io/py/django-comments-dab.svg
:target: https://badge.fury.io/py/django-comments-dab
.. image:: https://img.shields.io/pypi/v/django-comments-dab?color=gr
:alt: PyPI

.. image:: https://badge.fury.io/gh/radi85%2FComment.svg
:target: https://badge.fury.io/gh/radi85%2FComment
.. image:: https://img.shields.io/github/v/tag/radi85/Comment?color=gr
:alt: GitHub tag (latest SemVer)

.. image:: https://travis-ci.org/Radi85/Comment.svg
.. image:: https://travis-ci.org/Radi85/Comment.svg?branch=master
:target: https://travis-ci.org/Radi85/Comment

.. image:: https://coveralls.io/repos/github/Radi85/Comment/badge.svg
Expand All @@ -20,13 +20,21 @@
:target: https://django-comment-dab.readthedocs.io/?badge=latest
:alt: Documentation Status

.. image:: https://img.shields.io/github/license/radi85/Comment
.. image:: https://img.shields.io/github/license/radi85/Comment?color=gr
:alt: GitHub

.. image:: https://img.shields.io/pypi/dm/django-comments-dab
:alt: PyPI - Downloads


===================
django-comments-dab
===================


.. image:: /docs/_static/img/comment.gif


Content:

* Introduction_
Expand Down Expand Up @@ -230,8 +238,8 @@ These tags need to be included in the end of your base template.
2. Advanced usage:
------------------

1. Customize or remove the pagination:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Pagination:
^^^^^^^^^^^^^^^

By default the comments will be paginated, 10 comments per page.
To disabled the pagination pass ``comments_per_page=None``
Expand All @@ -247,8 +255,8 @@ These tags need to be included in the end of your base template.



2. Integrate existing profile app with comments app:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2. Integrate user profile:
^^^^^^^^^^^^^^^^^^^^^^^^^^

If you have a profile model for the user and you would like to show the
profile image next to each comment, do the following steps:
Expand Down Expand Up @@ -280,6 +288,36 @@ These tags need to be included in the end of your base template.
def get_absolute_url(self):
return reverse('your_profile_url_name')
.. _Enable Flagging:

3. Enable flagging:
^^^^^^^^^^^^^^^^^^^

The comment can be reported by the users.
This feature can be enabled by adding the ``COMMENT_FLAGS_ALLOWED`` to ``settings.py`` and its value must be greater than 0 (the default).

The comment that has been reported more than the ``COMMENT_FLAGS_ALLOWED`` value, will be hidden from the view.

The default report reasons are:

1. Spam | Exists only to promote a service.
2. Abusive | Intended at promoting hatred.
3. Something else. With a message info, this option will be always appended reasons list.

The reasons can be customized by adding ``COMMENT_FLAG_REASONS`` list of tuples to ``settings.py``. E.g.

``settings.py``

.. code:: python
COMMENT_FLAG_REASONS = [
(1, _('Spam | Exists only to promote a service')),
(2, _('Abusive | Intended at promoting hatred')),
(3, _('Racist | Sick mentality')),
(4, _('Whatever | Your reason')),
...
]
.. _`Web API`:

Expand All @@ -302,7 +340,9 @@ There are 5 methods available to perform the following actions:

5. React to a comment. (Authenticated)

6. Retrieve the list of comments and associated replies to a given content type and object ID.
6. Report a comment. (Authenticated) Flagging system should be enabled

7. Retrieve the list of comments and associated replies to a given content type and object ID.

These actions are explained below.

Expand Down Expand Up @@ -432,6 +472,39 @@ Comment API actions:
PS: As in the UI, clicking the **liked** button will remove the reaction => unlike the comment. This behaviour is performed when repeating the same post request.


**6- Report a comment**

Flagging system must be enabled by adding the attribute ``COMMENT_FLAGS_ALLOWED`` to ``settings.py``. See `Enable Flagging`_

``POST`` is the allowed method to report a comment.

Authorization must be provided as a TOKEN or USERNAME:PASSWORD.

This action requires the ``comment.id``.

1. Set a flag:

.. code:: python
payload = {
'reason': REASON, # number of the reason
'info': '' # this is required if the reason is 100 ``Something else``
}
::

$ curl -X POST -u USERNAME:PASSWORD -H "Content-Type: application/json" -d '{"reason":1, "info":""}' http://localhost:8000/api/comments/ID/flag/


2. Un-flag a comment:

To un-flag a FLAGGED comment, set reason value to `0` or remove the payload from the request.

::

$ curl -X POST -u USERNAME:PASSWORD http://localhost:8000/api/comments/ID/flag/


.. _`Style Customization`:

Style Customize
Expand Down Expand Up @@ -495,9 +568,6 @@ Login with:

password: ``django-comments``

.. image:: /docs/_static/img/img_1.png


The icons are picked from `Feather`_. Many thanks for the good work.

.. _`Feather`: https://feathericons.com
Binary file added docs/_static/img/comment.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/source/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.6.0
-----

- Add flagging system - Report a comment

1.5.0
-----

Expand Down
39 changes: 37 additions & 2 deletions docs/source/Web API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ There are 5 methods available to perform the following actions:

5. React to a comment. (Authenticated)

6. Retrieve the list of comments and associated replies to a given content type and object ID.
6. Report a comment. (Authenticated) Flagging system should be enabled

7. Retrieve the list of comments and associated replies to a given content type and object ID.

These actions are explained below.

Expand Down Expand Up @@ -145,5 +147,38 @@ Comment API actions:


PS: As in the UI, clicking the **liked** button will remove the reaction => unlike the comment. This behaviour is performed when repeating the same post request.
.


**6- Report a comment**

Flagging system must be enabled by adding the attribute ``COMMENT_FLAGS_ALLOWED`` to ``settings.py``. See :ref:`Enable Flagging`.

``POST`` is the allowed method to report a comment.

Authorization must be provided as a TOKEN or USERNAME:PASSWORD.

This action requires the ``comment.id``.

1. Set a flag:

.. code:: python
payload = {
'reason': REASON, # number of the reason
'info': '' # this is required if the reason is 100 ``Something else``
}
::

$ curl -X POST -u USERNAME:PASSWORD -H "Content-Type: application/json" -d '{"reason":1, "info":""}' http://localhost:8000/api/comments/ID/flag/


2. Un-flag a comment:

To un-flag a FLAGGED comment, set reason value to `0` or remove the payload from the request.

::

$ curl -X POST -u USERNAME:PASSWORD http://localhost:8000/api/comments/ID/flag/


4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = 'Radico'

# The short X.Y version
version = '1.5.0'
version = '1.6.0'
# The full version, including alpha/beta/rc tags
release = '1.5.0'
release = '1.6.0'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Login with:

password: ``django-comments``

.. image:: ../_static/img/img_1.png
.. image:: ../_static/img/comment.gif
22 changes: 15 additions & 7 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
django-comments-dab
===================

.. image:: https://img.shields.io/pypi/v/django-comments-dab?color=gr
:alt: PyPI

.. image:: https://badge.fury.io/py/django-comments-dab.svg
:target: https://badge.fury.io/py/django-comments-dab
.. image:: https://img.shields.io/github/v/tag/radi85/Comment?color=gr
:alt: GitHub tag (latest SemVer)

.. image:: https://badge.fury.io/gh/radi85%2FComment.svg
:target: https://badge.fury.io/gh/radi85%2FComment

.. image:: https://travis-ci.org/Radi85/Comment.svg
.. image:: https://travis-ci.org/Radi85/Comment.svg?branch=master
:target: https://travis-ci.org/Radi85/Comment

.. image:: https://coveralls.io/repos/github/Radi85/Comment/badge.svg
Expand All @@ -20,9 +19,18 @@ django-comments-dab
.. image:: https://img.shields.io/pypi/djversions/django-comments-dab.svg
:target: https://pypi.python.org/pypi/django-comments-dab/

.. image:: https://img.shields.io/github/license/radi85/Comment
.. image:: https://readthedocs.org/projects/django-comment-dab/badge/?version=latest
:target: https://django-comment-dab.readthedocs.io/?badge=latest
:alt: Documentation Status

.. image:: https://img.shields.io/github/license/radi85/Comment?color=gr
:alt: GitHub

.. image:: https://img.shields.io/pypi/dm/django-comments-dab
:alt: PyPI - Downloads

.. image:: ../_static/img/comment.gif

Introduction
============

Expand Down
39 changes: 35 additions & 4 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ These tags need to be included in the end of your base template.
2. Advanced usage:
------------------

1. Customize or remove the pagination:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Pagination:
^^^^^^^^^^^^^^^

By default the comments will be paginated, 10 comments per page.
To disabled the pagination pass ``comments_per_page=None``
Expand All @@ -64,8 +64,8 @@ These tags need to be included in the end of your base template.



2. Integrate existing profile app with comments app:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2. Integrate user profile:
^^^^^^^^^^^^^^^^^^^^^^^^^^

If you have a profile model for the user and you would like to show the
profile image next to each comment, do the following steps:
Expand Down Expand Up @@ -97,3 +97,34 @@ These tags need to be included in the end of your base template.
def get_absolute_url(self):
return reverse('your_profile_url_name')
.. _Enable Flagging:

3. Enable flagging:
^^^^^^^^^^^^^^^^^^^

The comment can be reported by the users.
This feature can be enabled by adding the ``COMMENT_FLAGS_ALLOWED`` to ``settings.py`` and its value must be greater than 0 (the default).

The comment that has been reported more than the ``COMMENT_FLAGS_ALLOWED`` value, will be hidden from the view.

The default report reasons are:

1. Spam | Exists only to promote a service.
2. Abusive | Intended at promoting hatred.
3. Something else. With a message info, this option will be always appended reasons list.

The reasons can be customized by adding ``COMMENT_FLAG_REASONS`` list of tuples to ``settings.py``. E.g.

``settings.py``

.. code:: python
COMMENT_FLAG_REASONS = [
(1, _('Spam | Exists only to promote a service')),
(2, _('Abusive | Intended at promoting hatred')),
(3, _('Racist | Sick mentality')),
(4, _('Whatever | Your reason')),
...
]
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='django-comments-dab',
version='1.5.0',
version='1.6.0',
packages=find_packages(exclude=['docs', 'test*']),
include_package_data=True,
author=u'Radico',
Expand Down Expand Up @@ -38,6 +38,6 @@
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
keywords='comment comment development',
keywords='django comment development ajax',
zip_safe=False,
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ commands =
flake8 comment/
python manage.py migrate
coverage run manage.py test
coverage report
coverage report -m

setenv =
PYTHONDONTWRITEBYTECODE=1

0 comments on commit b56a6be

Please sign in to comment.