{ "info": { "author": "Oleg Kleschunov", "author_email": "igorkleschunov@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "==============================\ndjango-ok-likes |PyPI version|\n==============================\n\n|Build Status| |Code Health| |Python Versions| |Requirements Status| |license| |PyPI downloads| |Coverage|\n\n``django-ok-likes`` is a liking app for Django, which allows users \"like\" and \"unlike\" any model instance. All functionality provides through `django-rest-framework`_ API views. Template tags and jinja's global functions provide the ability to see who liked an object, which objects were liked by current user and count of likes for a given object.\n\nInstallation\n============\n\nInstall with pip:\n\n.. code:: shell\n \n pip install django-ok-likes\n\n\nUpdate INSTALLED_APPS:\n\n.. code:: python\n\n INSTALLED_APPS = [\n ...\n 'likes',\n 'rest_framework',\n ...\n ]\n\n\nMake migrations:\n\n.. code:: shell\n\n python manage.py migrate\n\n\nAdd ``likes.api.urls`` to your project urlpatterns:\n\n.. code:: python\n\n urlpatterns = [\n ...\n path('api/v1/', include('likes.api.urls')),\n ...\n ]\n\n\nAvailable settings\n==================\n\nAdd the models that you want to like to LIKES_MODELS in your settings file:\n\n.. code:: python\n\n LIKES_MODELS = {\n \"app.Model\": {\n 'serializer': 'app.api.serializer.YourModelSerializer'\n },\n }\n\n\nYou can set any pagination class for ListAPIView:\n\n.. code:: python\n \n LIKES_REST_PAGINATION_CLASS = 'core.api.pagination.MyResponsePagination'\n\n\nUsage\n=====\n\nAPI\n---\n\nBase endpoints\n**************\n\n1. ``/api/v1/likes/list/`` - List API View to return all likes for authenticated user.\n \n You can set ``serializer`` for each model in ``LIKES_MODELS`` setting to use it for content object serialization, otherwise, you will get an id of content object. \n\n For example:\n\n .. code:: python\n\n LIKE_MODELS = {\n \"article.Article\": {\n 'serializer': 'article.api.serializers.ArticleSerializer'\n },\n }\n\n\n Use ``GET`` parameter ``search`` to filter by a content type's model:\n `/api/v1/likes/list/?search=article`\n\n2. ``/api/v1/likes/count/`` - API View to return count of likes for authenticated user.\n\n3. ``/api/v1/likes/is/`` - API View to check is given elements are liked by authenticated user. As result, you will get a list of ``ids``. \n\n Possible payload:\n\n .. code:: json\n\n {\n \"content_type\": 1,\n \"ids\": [1,2,3]\n }\n \n\n Possible result:\n\n .. code:: json\n\n {\n \"ids\": [1,3]\n }\n \n\n4. ``/api/v1/likes/toggle/`` - API View to like-unlike a given object by authenticated user. \n \n Possible payload:\n\n .. code:: json\n\n {\n \"content_type\": 1,\n \"id\": 1\n }\n \n\n Possible result:\n\n .. code:: json\n\n {\n \"is_liked\": true\n }\n\n\nFilters\n-------\n\nlikes_count\n***********\n\nReturns a count of likes for a given object:\n\n.. code:: django\n\n {{ object|likes_count }}\n\n\nTemplate Tags\n-------------\n\nwho_liked\n*********\n\nReturns a queryset of users, who liked a given object:\n\n.. code:: django\n\n {% who_liked object as fans %}\n\n {% for user in fans %}\n
{{ user.get_full_name }} likes {{ object }}
\n {% endfor %}\n\n\nlikes\n*****\n\nReturns a queryset of likes for a given user:\n\n.. code:: django\n\n {% likes request.user as user_likes %}\n {% for like in user_likes %}\n
{{ like }}
\n {% endfor %}\n\n\nis_liked\n********\n\nReturns a bool value, which says is a given object liked by a given user:\n\n.. code:: django\n\n {% is_liked object request.user as liked %}\n\n\nJinja global functions\n----------------------\n\nget_likes_count\n***************\n\nThe same as the ``likes_count`` filter.\n\nUsage:\n\n.. code:: django\n \n {{ get_likes_count(object) }}\n\n\nget_who_liked\n*************\n\nThe same as the ``who_liked`` tag.\n\nUsage:\n\n.. code:: django\n\n {{ get_who_liked(object) }}\n\n\nget_likes\n*********\n\nThe same as the ``likes`` tag.\n\nUsage:\n\n.. code:: django\n\n {{ get_likes(request.user) }}\n\n\nget_is_liked\n************\n\nThe same as the ``is_liked`` tag.\n\nUsage:\n\n.. code:: django\n\n {{ get_is_liked(object, request.user) }}\n\n\nSignals\n-------\n\nlikes.signals.object_liked\n**************************\n\nA signal, which sents immediately after the object was liked and provides the single kwarg of created `Like` instance.\n\nlikes.signals.object_unliked\n****************************\n\nA signal, which sents immediately after the object was unliked and provides the single kwarg of an object.\n\n\n.. |PyPI version| image:: https://badge.fury.io/py/django-ok-likes.svg\n :target: https://badge.fury.io/py/django-ok-likes\n.. |Build Status| image:: https://travis-ci.org/LowerDeez/ok-likes.svg?branch=master\n :target: https://travis-ci.org/LowerDeez/ok-likes\n :alt: Build status\n.. |Code Health| image:: https://api.codacy.com/project/badge/Grade/aa7e0f444c8d4520b0f0db5abc3a5960 \n :target: https://www.codacy.com/app/LowerDeez/ok-likes\n :alt: Code health\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/django-ok-likes.svg\n :target: https://pypi.org/project/django-ok-likes/\n :alt: Python versions\n.. |license| image:: https://img.shields.io/pypi/l/django-ok-likes.svg\n :alt: Software license\n :target: https://github.com/LowerDeez/ok-likes/blob/master/LICENSE\n.. |PyPI downloads| image:: https://img.shields.io/pypi/dm/django-ok-likes.svg\n :alt: PyPI downloads\n.. |Requirements Status| image:: https://requires.io/github/LowerDeez/ok-likes/requirements.svg?branch=master\n.. |Coverage| image:: https://coveralls.io/repos/github/LowerDeez/ok-likes/badge.svg?branch=master\n :target: https://coveralls.io/github/LowerDeez/ok-likes?branch=master\n :alt: Code coverage\n\n.. _django-rest-framework: https://www.django-rest-framework.org/", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/LowerDeez/ok-likes", "keywords": "python,likes,likes-models,django,voting", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-ok-likes", "package_url": "https://pypi.org/project/django-ok-likes/", "platform": "", "project_url": "https://pypi.org/project/django-ok-likes/", "project_urls": { "Homepage": "https://github.com/LowerDeez/ok-likes" }, "release_url": "https://pypi.org/project/django-ok-likes/0.4/", "requires_dist": null, "requires_python": "", "summary": "Django likes app", "version": "0.4" }, "last_serial": 5272780, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f25e0573c1956318270806e1cc57c332", "sha256": "974d8a5065bd2cfdf99801a828ee48c06dbcc74ba511040de955cf8805804801" }, "downloads": -1, "filename": "django-ok-likes-0.1.tar.gz", "has_sig": false, "md5_digest": "f25e0573c1956318270806e1cc57c332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11373, "upload_time": "2019-03-28T09:33:52", "url": "https://files.pythonhosted.org/packages/4a/f1/db3f213aa403d2a129e5334d43c8e9668a6e0eb556a9fc09208c5fa2580e/django-ok-likes-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "563e5a5c7849cf46ddb58c697247490e", "sha256": "4b5fedf22237bb01f5ee2c20ff3c0756e5f38f2b58bcd524c04dfd1ec1144028" }, "downloads": -1, "filename": "django-ok-likes-0.2.tar.gz", "has_sig": false, "md5_digest": "563e5a5c7849cf46ddb58c697247490e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11311, "upload_time": "2019-04-09T15:06:59", "url": "https://files.pythonhosted.org/packages/3a/cf/56d7ee3a90052ea29684f0db5fbfe9c828aef37421e2a5aa81874cc2101b/django-ok-likes-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "db75ef579a9c41f77e61bb3ad63ded10", "sha256": "f94e210292a296e8bd43e87fac8538e63f9059075c25b2984a8383f35d2b8256" }, "downloads": -1, "filename": "django-ok-likes-0.3.tar.gz", "has_sig": false, "md5_digest": "db75ef579a9c41f77e61bb3ad63ded10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11099, "upload_time": "2019-04-25T08:08:20", "url": "https://files.pythonhosted.org/packages/38/a2/fc42375a5add080dec91f391b3dd357ede444f411807d9e2095d24d64237/django-ok-likes-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "ca882e3201cfb71aea29737b03f02599", "sha256": "18d84e59b42783a12e23a0e074b32f6cd7734f769286bb10130f807ee0ff1dc7" }, "downloads": -1, "filename": "django-ok-likes-0.4.tar.gz", "has_sig": false, "md5_digest": "ca882e3201cfb71aea29737b03f02599", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14564, "upload_time": "2019-05-15T14:42:03", "url": "https://files.pythonhosted.org/packages/0e/2e/de2be199fa0e33d69be3b09ce46140be1a63f64e8872ada863376d804060/django-ok-likes-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ca882e3201cfb71aea29737b03f02599", "sha256": "18d84e59b42783a12e23a0e074b32f6cd7734f769286bb10130f807ee0ff1dc7" }, "downloads": -1, "filename": "django-ok-likes-0.4.tar.gz", "has_sig": false, "md5_digest": "ca882e3201cfb71aea29737b03f02599", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14564, "upload_time": "2019-05-15T14:42:03", "url": "https://files.pythonhosted.org/packages/0e/2e/de2be199fa0e33d69be3b09ce46140be1a63f64e8872ada863376d804060/django-ok-likes-0.4.tar.gz" } ] }