{ "info": { "author": "sax", "author_email": "sax@os4d.org", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "=====================\ndjango-strategy-field\n=====================\n\nSet of custom fields useful to implement the `Strategy Pattern`_ with Django models.\n\nThe Strategies are displayed in SelectBoxes as standard choice field\n\nThis package provides the following custom fields:\n\n* StrategyField\n* MultipleStrategyField\n* StrategyClassField\n* MultipleStrategyClassField\n\nThe StrategyField can be accessed as instance of the model with an attribute\n``context`` that points to model that 'owns' the field (inverse relation). So:\n\nExample\n=======\n\n.. code-block:: python\n\n from strategy_field.fields import StrategyField\n from django.core.mail.backends.filebased.EmailBackend\n\n\n class Event(models.Model):\n backend = StrategyField()\n\n Event(sender='django.core.mail.backends.filebased.EmailBackend')\n\n\nUse case\n========\n\nAs example we can imagine an application that manages `Events` that need to be notified to users.\nEach `Occurrence` of `Event` can be notified using different transport, (email, sms,...).\nWe want to be able to add/change the way we send notification, per event basis, simply using\nthe Django admin panel.\n\n.. code-block:: python\n\n from strategy_field.fields import StrategyField\n from strategy_field.registry import Registry\n\n class TransportRegistry(Registry)\n pass\n\n class AbstractStrategy(object):\n def __init__(self, context):\n self.context = context\n\n def send(self):\n raise NotImplementedError\n\n class EmailStrategy(AbstractTransport):\n def send(self):\n ...\n\n class SMSStrategy(AbstractTransport):\n def send(self):\n ...\n registry = TransportRegistry(AbstractTransport)\n registry.register(EmailStrategy)\n registry.register(SMSStrategy)\n\n class Event(models.Model):\n sender = StrategyField(registry)\n\n Event.objects.get_or_create(sender=EmailStrategy)\n ...\n ...\n e = Event.objects.get(sender=EmailStrategy)\n e.sender.send() # e.sender.context == e\n\n\nMore examples\n-------------\n\nUse callable\n~~~~~~~~~~~~\n\n.. code-block:: python\n\n from strategy_field.fields import StrategyField\n from strategy_field.registry import Registry\n\n registry1 = Registry()\n registry2 = Registry()\n\n class A(model):\n sender = StrategyField(registry=lambda model: model._registry)\n class Meta:\n abstract = True\n\n class C1(A):\n _registry = registry1\n class Meta:\n abstract = True\n\n class C2(A):\n _registry = registry2\n class Meta:\n abstract = True\n\n\nProject links\n=============\n\n+--------------------+----------------+--------------+---------------------------+\n| Stable | |master-build| | |master-cov| | |\n+--------------------+----------------+--------------+---------------------------+\n| Development | |dev-build| | |dev-cov| | |\n+--------------------+----------------+--------------+---------------------------+\n| Project home page: |https://github.com/saxix/django-strategy-field |\n+--------------------+---------------+-------------------------------------------+\n| Issue tracker: |https://github.com/saxix/django-strategy-field/issues?sort |\n+--------------------+---------------+-------------------------------------------+\n| Download: |http://pypi.python.org/pypi/django-strategy-field/ |\n+--------------------+---------------+-------------------------------------------+\n\n.. _Strategy Pattern: http://www.oodesign.com/strategy-pattern.html\n\n.. |master-build| image:: https://secure.travis-ci.org/saxix/django-strategy-field.png?branch=master\n :target: http://travis-ci.org/saxix/django-strategy-field/\n\n.. |master-cov| image:: https://codecov.io/github/saxix/django-strategy-field/coverage.svg?branch=master\n :target: https://codecov.io/github/saxix/django-strategy-field?branch=develop\n\n\n.. |dev-build| image:: https://secure.travis-ci.org/saxix/django-strategy-field.png?branch=develop\n :target: http://travis-ci.org/saxix/django-strategy-field/\n\n.. |dev-cov| image:: https://codecov.io/github/saxix/django-strategy-field/coverage.svg?branch=develop\n :target: https://codecov.io/github/saxix/django-strategy-field?branch=develop", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/saxix/django-strategy-field", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-strategy-field", "package_url": "https://pypi.org/project/django-strategy-field/", "platform": "linux", "project_url": "https://pypi.org/project/django-strategy-field/", "project_urls": { "Homepage": "https://github.com/saxix/django-strategy-field" }, "release_url": "https://pypi.org/project/django-strategy-field/1.3.2/", "requires_dist": null, "requires_python": "", "summary": "Django custom field to implement the strategy pattern", "version": "1.3.2" }, "last_serial": 4155873, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2724b2d0a1f10297c363e7aadd7410cd", "sha256": "784aceb186fa815c3a07c792313cc3159079652d3fc28f5075ae05c388b9d36d" }, "downloads": -1, "filename": "django-strategy-field-0.1.tar.gz", "has_sig": false, "md5_digest": "2724b2d0a1f10297c363e7aadd7410cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5243, "upload_time": "2014-11-18T18:42:04", "url": "https://files.pythonhosted.org/packages/f9/1d/5583ceda3b5ac656fab7f4e8af61683f2143b95d06be8b79132d41e913cc/django-strategy-field-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "8a7580d07daa6df8caddb16b4ef0ba12", "sha256": "9d06988dc52deb97427ea5f853385c1f2571d25ce8021b37fa0a5a0ded2e8553" }, "downloads": -1, "filename": "django_strategy_field-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8a7580d07daa6df8caddb16b4ef0ba12", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8208, "upload_time": "2015-12-22T14:17:51", "url": "https://files.pythonhosted.org/packages/56/c3/458d97702c49786d5347e010d1c264b07ea134657e98be6a536f8df09387/django_strategy_field-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ccc752ab2057cf05b8a45864a91d2d1", "sha256": "589164ef5d599921c4811a56bb9c6b16825090aebcb690934e51b54bc9f7a667" }, "downloads": -1, "filename": "django-strategy-field-0.2.tar.gz", "has_sig": false, "md5_digest": "2ccc752ab2057cf05b8a45864a91d2d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13747, "upload_time": "2015-12-22T14:17:40", "url": "https://files.pythonhosted.org/packages/22/a2/b0703ed50380f82b44792d07883733b24b2acd186c2d786a1d381b95f084/django-strategy-field-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "bc1012476b1d9ffcbe16b5c89ebd8dac", "sha256": "4c84b6f7cf921febf555c08be462097fae220a08d279be7804e2c19d57bf74ab" }, "downloads": -1, "filename": "django-strategy-field-0.3.tar.gz", "has_sig": false, "md5_digest": "bc1012476b1d9ffcbe16b5c89ebd8dac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14957, "upload_time": "2016-05-07T19:47:28", "url": "https://files.pythonhosted.org/packages/7f/18/441b99f88f7b5bf4478af9b8286e44c1da294aab938bb2ee9248be824f45/django-strategy-field-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "943ff4111ace1d7e286a6d7a5695ad4e", "sha256": "851e072591f83198ce8b3e4e1ce5bd51311d0d6047fed1709084e4aa3b97ccba" }, "downloads": -1, "filename": "django-strategy-field-0.4.tar.gz", "has_sig": false, "md5_digest": "943ff4111ace1d7e286a6d7a5695ad4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15733, "upload_time": "2016-07-29T23:18:40", "url": "https://files.pythonhosted.org/packages/3e/90/823f06b82903b2f633d89a949158cc50e7624e414c49bf3ebbbea145054b/django-strategy-field-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "ca31ee19da4eaeb6abd4ad3cee489f93", "sha256": "7649e747bd6f27489a137fa2e4621d73e1bb9bb74768a3ca8e0b15babfb2311a" }, "downloads": -1, "filename": "django-strategy-field-0.5.tar.gz", "has_sig": false, "md5_digest": "ca31ee19da4eaeb6abd4ad3cee489f93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15914, "upload_time": "2016-08-03T20:06:33", "url": "https://files.pythonhosted.org/packages/5a/fb/2a4e383877e95b8927dcb883d381691332e27dd3e3c979b6d0825ef5821d/django-strategy-field-0.5.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "5bb7dce0e22e8db7b6e065ef7accb5e6", "sha256": "5facdf59b8d9f3c23a1d10f3d4f62757538dec4aa0f7d96e7575e1087922d4a3" }, "downloads": -1, "filename": "django-strategy-field-1.0.tar.gz", "has_sig": false, "md5_digest": "5bb7dce0e22e8db7b6e065ef7accb5e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16700, "upload_time": "2016-09-19T05:47:55", "url": "https://files.pythonhosted.org/packages/26/e5/434aac4eb685df057e420ee8970e240ab9cd63cfe9cf216ec72aa4843ec6/django-strategy-field-1.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "e4daf574844a4afb8107231c0f2edc83", "sha256": "cd0279f0c4e7c9738cb9682b31f9a75bc8b523bf7776020c5648723c0c483308" }, "downloads": -1, "filename": "django-strategy-field-1.1.0.tar.gz", "has_sig": false, "md5_digest": "e4daf574844a4afb8107231c0f2edc83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17187, "upload_time": "2017-07-12T12:56:25", "url": "https://files.pythonhosted.org/packages/4c/f1/8524056f0581e42b245eb8b8dea9e9a1bd82df2c63282524cb79d210a962/django-strategy-field-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "3aeaf3820cdb5b76b254aee023fb55a8", "sha256": "cf93d8fbf914c4af12869f2a1308ab63702c936e40d24134ca5e78f4209a4d0d" }, "downloads": -1, "filename": "django-strategy-field-1.1.1.tar.gz", "has_sig": false, "md5_digest": "3aeaf3820cdb5b76b254aee023fb55a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17880, "upload_time": "2018-01-17T19:14:46", "url": "https://files.pythonhosted.org/packages/02/6d/ed9b635f00f97e5eb0c01ded86a7c21a7c6d6df238d454808a1cb64121f7/django-strategy-field-1.1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "896ef286408a94fd445c35dfd2e69994", "sha256": "e58889339b12f392024ebb3eac0a20db98f3806d14cf22100d3fea8f94b3d65b" }, "downloads": -1, "filename": "django-strategy-field-1.2.tar.gz", "has_sig": false, "md5_digest": "896ef286408a94fd445c35dfd2e69994", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27700, "upload_time": "2018-02-11T11:49:31", "url": "https://files.pythonhosted.org/packages/79/fd/c119cb5fab1c6fa64292c0e24f6c45df7844f8d53797c3cb7a4f4abd9089/django-strategy-field-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "fd902ec2890b3641e3ab32db0fe099f3", "sha256": "eed64d9693eb71cb1fbaacbe46e37cb6af9091f50d5e6f6caee0b764e0cf4694" }, "downloads": -1, "filename": "django-strategy-field-1.3.tar.gz", "has_sig": false, "md5_digest": "fd902ec2890b3641e3ab32db0fe099f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18714, "upload_time": "2018-02-23T16:03:48", "url": "https://files.pythonhosted.org/packages/b8/19/e3d95c9bf0b65629b7edf703dfe9a18ccb7218f39fcc031ab9d6e607e821/django-strategy-field-1.3.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "dcd7b6feb5aaacfdebf3833d6e61d61f", "sha256": "e5d8347ac02dc4f8fe490c66a2b6271189ca7d2b6fdb12ef0c8ba91f26c41056" }, "downloads": -1, "filename": "django-strategy-field-1.3.1.tar.gz", "has_sig": false, "md5_digest": "dcd7b6feb5aaacfdebf3833d6e61d61f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18791, "upload_time": "2018-02-23T16:06:05", "url": "https://files.pythonhosted.org/packages/6c/2b/167d07430b4e53c3fe17d28996377479072250f4cb761ed3e15e6a071c4e/django-strategy-field-1.3.1.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "dc03b3d7c539f51f6368fc52d58afb98", "sha256": "659ce7d1fec5dc7770291f64d530e345e155d4d24f843f225d0b5a451f7b3706" }, "downloads": -1, "filename": "django-strategy-field-1.3.2.tar.gz", "has_sig": false, "md5_digest": "dc03b3d7c539f51f6368fc52d58afb98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23656, "upload_time": "2018-08-10T08:45:43", "url": "https://files.pythonhosted.org/packages/20/4f/cb02c68983d81d6d74e87144a64f14f31f050bf0d37ca636aec020e5da83/django-strategy-field-1.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dc03b3d7c539f51f6368fc52d58afb98", "sha256": "659ce7d1fec5dc7770291f64d530e345e155d4d24f843f225d0b5a451f7b3706" }, "downloads": -1, "filename": "django-strategy-field-1.3.2.tar.gz", "has_sig": false, "md5_digest": "dc03b3d7c539f51f6368fc52d58afb98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23656, "upload_time": "2018-08-10T08:45:43", "url": "https://files.pythonhosted.org/packages/20/4f/cb02c68983d81d6d74e87144a64f14f31f050bf0d37ca636aec020e5da83/django-strategy-field-1.3.2.tar.gz" } ] }