{ "info": { "author": "Gizmag", "author_email": "tech@gizmag.com", "bugtrack_url": null, "classifiers": [], "description": "Django Generic Follow\n=====================\n\n|Build Status|\n\ndjango-generic-follow is a system to allow users to follow any model in\na Django project.\n\nInstallation / Setup\n--------------------\n\nBasics\n~~~~~~\n\nFirst, install the package with pip\n\n.. code:: bash\n\n pip install django-generic-follow\n\nThen add ``generic_follow`` to your ``INSTALLED_APPS``\n\n.. code:: python\n\n INSTALLED_APPS = (\n ...,\n 'generic_follow',\n )\n\nUser Model\n~~~~~~~~~~\n\nIf you are using the ``auth.User`` user model, the user instance methods\nwill be set up for you. If you are using a custom User model, you will\nneed to apply the ``UserFollowMixin``\n\n.. code:: python\n\n from django.contrib.auth.models import AbstractUser\n from generic_follow.model_mixins import UserFollowMixin\n\n class MyCustomUser(UserFollowMixin, AbstractUser):\n ...\n\nTarget Models\n~~~~~~~~~~~~~\n\nTo add the convenience methods to models that will be followed apply the\n``TargetFollowMixin``\n\n.. code:: python\n\n from django.db import models\n from generic_follow.model_mixins import TargetFollowMixin\n\n\n class Band(TargetFollowMixin, models.Model):\n name = models.CharField(max_length=255)\n\nUsage\n-----\n\nFollow/Unfollow\n~~~~~~~~~~~~~~~\n\nTo make a user follow a model instance use the ``user.follow`` method\n\n.. code:: python\n\n user = User.objects.first()\n band = Band.objects.get(name='Foals')\n\n user.follow(band)\n\nTo make a user unfollow a model instance simply call ``user.unfollow``\n\n.. code:: python\n\n user.unfollow(band)\n\nChecking if a user currently follows a model instance involves calling\n``user.is_following``\n\n.. code:: python\n\n user.is_following(band)\n # true/false\n\nRetrieval Methods\n~~~~~~~~~~~~~~~~~\n\nTo see all model instances that a user is following call the\n``user.get_follow_set`` method.\n\n.. code:: python\n\n user.get_follow_set()\n # []\n\nOptionally, the ``model`` kwarg can be provided to only return followed\ninstances of that model type\n\n.. code:: python\n\n user.get_follow_set(Photographer)\n # []\n\nOn the follow target, ``model.get_follower_set`` can be called to\nretrieve all followers\n\n.. code:: python\n\n band.get_follower_set()\n\nBatch Operations\n~~~~~~~~~~~~~~~~\n\nTo make a list of users follow a given model instance call the\n``create_batch`` manager method\n\n.. code:: python\n\n user2 = ...\n\n Follow.objects.create_batch(users=[user, user2], target=band)\n\nTo perform the inverse, call the ``delete_batch`` manager method\n\n.. code:: python\n\n Follow.objects.delete_batch(users=[user, user2], target=band)\n\nTo make some users follow a model instance, and others unfollow the same\nmodel instance in the same command, use ``update_batch``. The\n``users_follow`` kwarg accepts a 2-tuple of user instance, and a boolean\nindicating if this user should be following the instance.\n\n.. code:: python\n\n Follow.objects.update_batch(\n target=band,\n users_follow=[(user, True), (user2, False)]\n )\n # user will now be following foals, user2 will now not be following foals\n\nSignals\n~~~~~~~\n\nBatch operations emit signals which can be used elsewhere in your\nproject.\n\n``follow_bulk_create``: Sent after ``Follow.objects.create_batch()``\ncompletes\n\n``follow_bulk_delete``: Sent after ``Follow.objects.delete_batch()``\ncompletes\n\nThese signals send ``users`` and ``target`` as kwargs.\n\nConnecting to these signals is the same as any other Django signal\n\n.. code:: python\n\n def bulk_create_callback(sender, **kwargs):\n ...\n\n from generic_follow.signals import follow_bulk_create \n follow_bulk_create.connect(bulk_create_callback, sender=Follow)\n\nContributions\n-------------\n\nPull requests / issues welcome!\n\n.. |Build Status| image:: https://travis-ci.org/gizmag/django-generic-follow.png?branch=master\n :target: https://travis-ci.org/gizmag/django-generic-follow", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gizmag/django-generic-follow", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-generic-follow", "package_url": "https://pypi.org/project/django-generic-follow/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-generic-follow/", "project_urls": { "Homepage": "https://github.com/gizmag/django-generic-follow" }, "release_url": "https://pypi.org/project/django-generic-follow/0.5.2/", "requires_dist": [ "django (>=1.8)" ], "requires_python": "", "summary": "Generic follow system for Django", "version": "0.5.2" }, "last_serial": 2070598, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0d1e65ed90ffb56d4eabd41cd3d06b0e", "sha256": "61c40606f0da3c3c4875f3e372bfeabf5e8532ca00075f73df6f13ed82e74473" }, "downloads": -1, "filename": "django-generic-follow-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0d1e65ed90ffb56d4eabd41cd3d06b0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2826, "upload_time": "2014-02-27T23:42:43", "url": "https://files.pythonhosted.org/packages/51/26/5b89dd7f5e8a0caa7c6d02323e1ea5a844b6551c9906b28a2d8e37bbc45c/django-generic-follow-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "f5997afd32224bcb2375e0b362a9a987", "sha256": "4c7232597dba14308880ef0b1cb60e64fd58edf8e391c21e13311c0d85ce6039" }, "downloads": -1, "filename": "django-generic-follow-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f5997afd32224bcb2375e0b362a9a987", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3022, "upload_time": "2014-04-15T04:02:44", "url": "https://files.pythonhosted.org/packages/55/c6/2d4b33082ccc7535f0ce630c61b863b273c978ef4a63e9f379699643d6ee/django-generic-follow-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "84474291b839f66e201cebb848c90c7a", "sha256": "d7df7173ed95d471f460056802732811065b88cf478f4c46b808452120ed1144" }, "downloads": -1, "filename": "django-generic-follow-0.3.0.tar.gz", "has_sig": false, "md5_digest": "84474291b839f66e201cebb848c90c7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3138, "upload_time": "2014-11-25T00:22:22", "url": "https://files.pythonhosted.org/packages/8f/b3/b72dadf2a3c38c4520f9fb0a6511b0afe17373e74e5c167b2e867fddc6a3/django-generic-follow-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "10a0895bc14a127055b3f2b4b2c73ebf", "sha256": "e3d32b930034719aa2532ea5fc0148dd6b7b0ed1f68458e6acd4ab04e34fbb1c" }, "downloads": -1, "filename": "django-generic-follow-0.4.0.tar.gz", "has_sig": false, "md5_digest": "10a0895bc14a127055b3f2b4b2c73ebf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3202, "upload_time": "2015-11-26T06:08:56", "url": "https://files.pythonhosted.org/packages/6a/22/116d7e2f16d0e7c7ea5afc1c13c0054656f42dfbbc59acd21b73ed43c588/django-generic-follow-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "024168f02cc61d0e4ec9efdea8468ab0", "sha256": "f0e2770c09743a83f54fd5fe073779b310399a854eae633c446971bee1ebff86" }, "downloads": -1, "filename": "django-generic-follow-0.4.1.tar.gz", "has_sig": false, "md5_digest": "024168f02cc61d0e4ec9efdea8468ab0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2589, "upload_time": "2015-11-26T06:15:16", "url": "https://files.pythonhosted.org/packages/0c/a1/44d9f838514b638fcbab346d309f95f9304fdea014919d5a9f9db5741cbb/django-generic-follow-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "9b813b1d60350d4027a62f61b729ef44", "sha256": "fb81a37f70144f6b4725e6f971fe5b3ce8fa4871f4eb56439050bb4a7bf056aa" }, "downloads": -1, "filename": "django-generic-follow-0.4.2.tar.gz", "has_sig": false, "md5_digest": "9b813b1d60350d4027a62f61b729ef44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3547, "upload_time": "2015-11-26T06:48:23", "url": "https://files.pythonhosted.org/packages/64/7e/2d673119da89bd638e7c5963b993dc4ec322787580fcb7925c71118e56c3/django-generic-follow-0.4.2.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "2ac53e3099ee8e6b0dba2705593f9c84", "sha256": "0a636bd490a89dcc9007203cfab4f9b30242bdb37d90955d9246c447ae169fa1" }, "downloads": -1, "filename": "django_generic_follow-0.5.0-py2-none-any.whl", "has_sig": false, "md5_digest": "2ac53e3099ee8e6b0dba2705593f9c84", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7495, "upload_time": "2016-02-19T03:40:14", "url": "https://files.pythonhosted.org/packages/b3/39/a0167ec7de92809a6abf5b283d21d4e051778ee94bea582fe30f9dcf76d8/django_generic_follow-0.5.0-py2-none-any.whl" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "d10ffa8476fed65b80170e453627d582", "sha256": "ede5ea424dbb460da9ff6bd92876998bf9196ffbf8e4e190ec84522567e9e5f2" }, "downloads": -1, "filename": "django_generic_follow-0.5.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d10ffa8476fed65b80170e453627d582", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10219, "upload_time": "2016-02-19T04:10:18", "url": "https://files.pythonhosted.org/packages/0a/5f/c8c09c83066d43af195ff8d8e5db6b7b7fa131b139a3620aa7c093793258/django_generic_follow-0.5.1-py2-none-any.whl" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "c47445918747f8d385b88604bbfd4f39", "sha256": "5b206ea34a7987ab0baf68eccf845dbd41e68bb5f4b0804ec3ba1c9224b52f7e" }, "downloads": -1, "filename": "django_generic_follow-0.5.2-py2-none-any.whl", "has_sig": false, "md5_digest": "c47445918747f8d385b88604bbfd4f39", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10233, "upload_time": "2016-02-19T05:24:57", "url": "https://files.pythonhosted.org/packages/ff/e7/49a0fbe753ebe2d238a501935630af7b2bc2a6a3098a821be6e6a16e04a2/django_generic_follow-0.5.2-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c47445918747f8d385b88604bbfd4f39", "sha256": "5b206ea34a7987ab0baf68eccf845dbd41e68bb5f4b0804ec3ba1c9224b52f7e" }, "downloads": -1, "filename": "django_generic_follow-0.5.2-py2-none-any.whl", "has_sig": false, "md5_digest": "c47445918747f8d385b88604bbfd4f39", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10233, "upload_time": "2016-02-19T05:24:57", "url": "https://files.pythonhosted.org/packages/ff/e7/49a0fbe753ebe2d238a501935630af7b2bc2a6a3098a821be6e6a16e04a2/django_generic_follow-0.5.2-py2-none-any.whl" } ] }