{ "info": { "author": "Basil Shubin", "author_email": "basil.shubin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-popularity-mixin\n=======================\n\nSimple integration between django-cacheback_ and django-hitcount_\n\nAuthored by `Basil Shubin `_\n\n.. image:: https://img.shields.io/pypi/v/django-popularity-mixin.svg\n :target: https://pypi.python.org/pypi/django-popularity-mixin/\n\n.. image:: https://img.shields.io/pypi/dm/django-popularity-mixin.svg\n :target: https://pypi.python.org/pypi/django-popularity-mixin/\n\n.. image:: https://img.shields.io/github/license/bashu/django-popularity-mixin.svg\n :target: https://pypi.python.org/pypi/django-popularity-mixin/\n\n.. image:: https://img.shields.io/travis/bashu/django-popularity-mixin.svg\n :target: https://travis-ci.org/bashu/django-popularity-mixin/\n\nRequirements\n------------\n\nYou must have *django-cacheback* and *django-hitcount* both installed and configured, see the\ndjango-cacheback_ and django-hitcount_ documentation for details and setup instructions.\n\n\nInstallation\n============\n\nFirst install the module, preferably in a virtual environment. It can be installed from PyPI:\n\n.. code-block:: shell\n\n pip install django-popularity-mixin\n\n\nSetup\n=====\n\nMake sure the project is configured for django-cacheback_ and django-hitcount_.\n\nThen add the following settings:\n\n.. code-block:: python\n\n INSTALLED_APPS += (\n 'popularity',\n )\n\nUsage\n=====\n\nThe ``popularity.views.PopularityMixin`` can be used to do the\nbusiness-logic of counting the hits asynchronously by setting\n``count_hit`` to ``True``.\n\n.. code-block:: python\n\n # views.py\n\n from django.views.generic.detail import DetailView\n\n from popularity.views import PopularityMixin\n\n\n class CustomDetailView(PopularityMixin, DetailView):\n count_hit = True # set to True if you want it to try and count the hit asynchronously\n template_name = \"template.html\"\n ...\n\nThe ``popularity.viwes.PopularityMixin`` extends Django\u2019s generic\n``django.views.generic.detail.DetailView`` and injects an additional\ncontext variable ``hitcount``.\n\n.. code-block:: html+django\n\n \n\n {# the primary key for the hitcount object #}\n {{ hitcount.pk }}\n\n {# the total hits for the object #}\n {{ hitcount.total_hits }}\n\nFor a more granular approach to viewing the hits for a related object you can use the ``get_hit_count`` template tag.\n\n.. code-block:: html+django\n\n {# remember to load the tags first #}\n {% load popularity_tags %}\n\n {# Return total hits for an object: #}\n {% get_hit_count for [object] %}\n\n {# Get total hits for an object as a specified variable: #}\n {% get_hit_count for [object] as [var] %}\n\n {# Get total hits for an object over a certain time period: #}\n {% get_hit_count for [object] within [\"days=1,minutes=30\"] %}\n\n {# Get total hits for an object over a certain time period as a variable: #}\n {% get_hit_count for [object] within [\"days=1,minutes=30\"] as [var] %}\n\nPlease see ``example`` application. This application is used to manually test the functionalities of this package. This also serves as good example...\n\nYou need Django 1.8.1 or above to run that. It might run on older versions but that is not tested.\n\nContributing\n------------\n\nIf you like this module, forked it, or would like to improve it, please let us know!\nPull requests are welcome too. :-)\n\n.. _django-cacheback: https://github.com/codeinthehole/django-cacheback\n.. _django-hitcount: https://github.com/thornomad/django-hitcount\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/bashu/django-popularity-mixin/zipball/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bashu/django-popularity-mixin", "keywords": "", "license": "LGPLv3 License", "maintainer": "", "maintainer_email": "", "name": "django-popularity-mixin", "package_url": "https://pypi.org/project/django-popularity-mixin/", "platform": "", "project_url": "https://pypi.org/project/django-popularity-mixin/", "project_urls": { "Download": "https://github.com/bashu/django-popularity-mixin/zipball/master", "Homepage": "https://github.com/bashu/django-popularity-mixin" }, "release_url": "https://pypi.org/project/django-popularity-mixin/0.1.8/", "requires_dist": null, "requires_python": "", "summary": "Simple integration between django-cacheback and django-hitcount", "version": "0.1.8" }, "last_serial": 4981361, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "568889e0d25432447e79c05be72909c0", "sha256": "39114998893e1078b05aa6ada9e0b3f30c749547242857f7bb432c668064fb3f" }, "downloads": -1, "filename": "django_popularity_mixin-0.1.6-py3-none-any.whl", "has_sig": true, "md5_digest": "568889e0d25432447e79c05be72909c0", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 9737, "upload_time": "2019-03-24T12:50:37", "url": "https://files.pythonhosted.org/packages/66/26/5aeed44fb7457cc66db5b399fa525b11953758cc70675075d0587e6b997c/django_popularity_mixin-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0b9ff076644dd1b0c03ba2b46fa33806", "sha256": "efa64aae573da39c5ee4ab038e19bbe383b382310be941c8bc0ef285401ec810" }, "downloads": -1, "filename": "django-popularity-mixin-0.1.6.tar.gz", "has_sig": true, "md5_digest": "0b9ff076644dd1b0c03ba2b46fa33806", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7496, "upload_time": "2019-03-24T12:50:34", "url": "https://files.pythonhosted.org/packages/8a/e7/2b7159ca26873d61e873f46cddac44fb52d8de0e26e5a73e558609b35775/django-popularity-mixin-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "cdb7b69a734313b65f039158bb8990f2", "sha256": "4eb62df25f200da91545a11a31c5a035463ae7eef43900dc3b9869609fd87813" }, "downloads": -1, "filename": "django_popularity_mixin-0.1.7-py3-none-any.whl", "has_sig": true, "md5_digest": "cdb7b69a734313b65f039158bb8990f2", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 10642, "upload_time": "2019-03-25T08:28:03", "url": "https://files.pythonhosted.org/packages/2a/04/04e17b45a8ab92630623e2314d5465391e1649041cf13752a3cf0048ed1e/django_popularity_mixin-0.1.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c08220ad72ac775c76b4867b990ee46b", "sha256": "af8c6e152a035ac31deda21b6dde515edc490d9ee73575178012d0ee4a363c4d" }, "downloads": -1, "filename": "django-popularity-mixin-0.1.7.tar.gz", "has_sig": true, "md5_digest": "c08220ad72ac775c76b4867b990ee46b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8586, "upload_time": "2019-03-25T08:28:01", "url": "https://files.pythonhosted.org/packages/83/2b/6f11776139b538a95016d6af86ef555cc1984a7bd527c40710ef7802fb41/django-popularity-mixin-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "c6e21eb30fe7ba26fdef806e4b83aa31", "sha256": "5306df0cd588d57792af5961d6dd690b2823c949734332ce7e99d1bce234ffcc" }, "downloads": -1, "filename": "django_popularity_mixin-0.1.8-py3-none-any.whl", "has_sig": true, "md5_digest": "c6e21eb30fe7ba26fdef806e4b83aa31", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 10635, "upload_time": "2019-03-25T08:41:29", "url": "https://files.pythonhosted.org/packages/a0/ec/f7bae238b05ba154f6eabdf8d314a0fe1fb58e9b7a7e56df29e27805e6b3/django_popularity_mixin-0.1.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4899c161aecce9564ae92f74485c2d92", "sha256": "be204bf21336e7c5e4bc5027027cfe22722402e49b6fc9e8a4dec8dc28de0eb4" }, "downloads": -1, "filename": "django-popularity-mixin-0.1.8.tar.gz", "has_sig": true, "md5_digest": "4899c161aecce9564ae92f74485c2d92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8575, "upload_time": "2019-03-25T08:41:26", "url": "https://files.pythonhosted.org/packages/6e/a7/6bcbe23af096726731f6cd14297b2156606b0137fa82aa33d8a89bb82bd7/django-popularity-mixin-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c6e21eb30fe7ba26fdef806e4b83aa31", "sha256": "5306df0cd588d57792af5961d6dd690b2823c949734332ce7e99d1bce234ffcc" }, "downloads": -1, "filename": "django_popularity_mixin-0.1.8-py3-none-any.whl", "has_sig": true, "md5_digest": "c6e21eb30fe7ba26fdef806e4b83aa31", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 10635, "upload_time": "2019-03-25T08:41:29", "url": "https://files.pythonhosted.org/packages/a0/ec/f7bae238b05ba154f6eabdf8d314a0fe1fb58e9b7a7e56df29e27805e6b3/django_popularity_mixin-0.1.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4899c161aecce9564ae92f74485c2d92", "sha256": "be204bf21336e7c5e4bc5027027cfe22722402e49b6fc9e8a4dec8dc28de0eb4" }, "downloads": -1, "filename": "django-popularity-mixin-0.1.8.tar.gz", "has_sig": true, "md5_digest": "4899c161aecce9564ae92f74485c2d92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8575, "upload_time": "2019-03-25T08:41:26", "url": "https://files.pythonhosted.org/packages/6e/a7/6bcbe23af096726731f6cd14297b2156606b0137fa82aa33d8a89bb82bd7/django-popularity-mixin-0.1.8.tar.gz" } ] }