diff --git a/README.md b/README.md
index a440036..80a09e2 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
``django-vote`` is a simple Django app to conduct vote for django model.
-This project is inspired by [django-taggit](https://github.com/alex/django-taggit)
+This project was inspired by [django-taggit](https://github.com/alex/django-taggit)
![Ci](https://github.com/shellfly/django-vote/actions/workflows/ci.yml/badge.svg)
[![codecov](https://codecov.io/gh/shellfly/django-vote/branch/master/graph/badge.svg)](https://codecov.io/gh/shellfly/django-vote)
@@ -41,7 +41,7 @@ manage.py makemigrations
manage.py migrate
```
-#### Use vote API
+### Use vote API
```python
review = ArticleReview.objects.get(pk=1)
@@ -65,6 +65,9 @@ review.votes.exists(user_id, action=DOWN)
# Returns the number of votes for the object
review.votes.count()
+# Returns the number of down votes for the object
+review.votes.count(action=DOWN)
+
# Returns a list of users who voted and their voting date
review.votes.user_ids()
@@ -74,9 +77,32 @@ Review.votes.all(user_id)
```
-#### Use `VoteMixin` for REST API
+### Use tags template
+
+There are two template tags you can use in template:
+1. `vote_count` to get vote count for a model instance
+2. `vote_exists` to check whether current user vote for the instance
+
+``` html
+{% load vote %}
+
+ {% for comment in comments %}
+ -
+ {{comment.content}} - up:{% vote_count comment "up" %} - down: {% vote_count comment "down" %} - exists_up:
+ {% vote_exists comment user "up" %} - exists_down: {% vote_exists comment user "down"%}
+
+ {% endfor %}
+
+```
+
+### Use `VoteMixin` for REST API
+
+Install [django-rest-framework](https://github.com/encode/django-rest-framework/)
``` python
+from rest_framework.viewsets import ModelViewSet
+from vote.views import VoteMixin
+
class CommentViewSet(ModelViewSet, VoteMixin):
queryset = Comment.objects.all()
serializer_class = CommentSerializer
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 8d28f81..7eb8c13 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,10 @@
Changelog
=========
+2.4.0 (2022.12.17)
+------------------
+* Add template tag to get vote count
+
2.3.0 (2022.02.06)
------------------
* Add support for Django 4.0
diff --git a/setup.py b/setup.py
index 0c163d9..01f183c 100644
--- a/setup.py
+++ b/setup.py
@@ -38,7 +38,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: 3.10"
+ "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
],
)
diff --git a/test/templates/test/comments.html b/test/templates/test/comments.html
index fbba1ab..c6a2185 100644
--- a/test/templates/test/comments.html
+++ b/test/templates/test/comments.html
@@ -3,7 +3,7 @@
{% for comment in comments %}
{{comment.content}} - up:{% vote_count comment "up" %} - down: {% vote_count comment "down" %} - exists_up:
- {%vote_exists comment user %} - exists_down: {% vote_exists comment user "down"%}
+ {%vote_exists comment user "up" %} - exists_down: {% vote_exists comment user "down"%}
{% endfor %}
diff --git a/vote/__init__.py b/vote/__init__.py
index fb9195f..3229d3a 100644
--- a/vote/__init__.py
+++ b/vote/__init__.py
@@ -1,3 +1,3 @@
-VERSION = (2, 3, 0)
+VERSION = (2, 4, 0)
default_app_config = "vote.apps.VoteAppConfig"