{"id":19073113,"url":"https://github.com/lowerdeez/ok-likes","last_synced_at":"2025-04-28T18:55:27.338Z","repository":{"id":57421087,"uuid":"153160718","full_name":"LowerDeez/ok-likes","owner":"LowerDeez","description":"This app provides like/unlike functionality through Django REST Framework APIView classes.","archived":false,"fork":false,"pushed_at":"2024-04-02T07:41:31.000Z","size":100,"stargazers_count":16,"open_issues_count":4,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-28T18:55:21.034Z","etag":null,"topics":["django","likes-count","likes-model","python","voting"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LowerDeez.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-15T18:16:17.000Z","updated_at":"2025-04-09T10:13:29.000Z","dependencies_parsed_at":"2025-04-18T07:43:22.079Z","dependency_job_id":"65966b67-09fc-4b5c-b415-26e72c8d1d88","html_url":"https://github.com/LowerDeez/ok-likes","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LowerDeez%2Fok-likes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LowerDeez%2Fok-likes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LowerDeez%2Fok-likes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LowerDeez%2Fok-likes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LowerDeez","download_url":"https://codeload.github.com/LowerDeez/ok-likes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251372466,"owners_count":21578964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","likes-count","likes-model","python","voting"],"created_at":"2024-11-09T01:45:27.773Z","updated_at":"2025-04-28T18:55:27.320Z","avatar_url":"https://github.com/LowerDeez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"==============================\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\n    Possible GET parameters:\n\n    .. code:: json\n\n        {\n            \"type\": \"app_label.model\",\n\n        }\n\n\n3. ``/api/v1/likes/is/`` - API View to return list of objects ids, which are liked by authenticated user. As result, you will get a list of ``ids``.  \n\n    Possible GET parameters:\n\n    .. code:: json\n\n        {\n            \"type\": \"app_label.model\",\n        }\n    \n\n    Possible result:\n\n    .. code:: json\n\n        {\n            \"ids\": [1, 2, 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            \"type\": \"app_label.model\",\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        \u003cdiv class=\"like\"\u003e{{ user.get_full_name }} likes {{ object }}\u003c/div\u003e\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        \u003cdiv\u003e{{ like }}\u003c/div\u003e\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/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flowerdeez%2Fok-likes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flowerdeez%2Fok-likes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flowerdeez%2Fok-likes/lists"}