{ "info": { "author": "Lucas Connors", "author_email": "lucas@revolutiontech.ca", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# django-conditions\n\n[![Build Status](https://travis-ci.org/RevolutionTech/django-conditions.svg?branch=master)](https://travis-ci.org/RevolutionTech/django-conditions)\n[![codecov](https://codecov.io/gh/RevolutionTech/django-conditions/branch/master/graph/badge.svg)](https://codecov.io/gh/RevolutionTech/django-conditions)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8fccc57f17e44c5496a912adc691fc39)](https://www.codacy.com/app/RevolutionTech/django-conditions)\n[![Dependency Status](https://www.versioneye.com/user/projects/56de7e4cdf573d0048dafc52/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56de7e4cdf573d0048dafc52)\n[![Documentation Status](https://readthedocs.org/projects/django-conditions/badge/?version=latest)](http://django-conditions.readthedocs.org/en/latest/)\n\nMove conditional logic that changes often from code into models so that the logic can be easily modified in admin. Some possible use cases:\n- Segment your user base into cohorts with targeted messaging\n- Provide different rewards to users depending on their expected value\n- In a game, define the winning objectives of a mission/quest\n- and many more...\n\n## Installation\n\n pip install django-conditions\n\n## Basic Usage\n\nStart by defining a condition in code:\n\n```python\n## condition_types.py\nfrom conditions import Condition\n\nclass FullName(Condition):\n # The name that appears in the db and represents your condition\n condstr = 'FULL_NAME'\n\n # Normal conditions define eval_bool, which takes in a user\n # and returns a boolean\n def eval_bool(self, user, **kwargs):\n return bool(user.first_name and user.last_name)\n```\n\nThen add a ConditionsField to your model:\n\n```python\n## models.py\nfrom django.db import models\nfrom conditions import ConditionsField, conditions_from_module\nimport condition_types\n\nclass Campaign(models.Model):\n text = models.TextField()\n\n # The ConditionsField requires the definitions of all possible conditions\n # conditions_from_module can take an imported module and sort this out for you\n target = ConditionsField(definitions=conditions_from_module(condition_types))\n```\n\nIn the model's change form on admin, you can enter JSON to represent when you want your condition to be satisfied.\n\n```javascript\n{\n \"all\": [\"FULL_NAME\"]\n}\n```\n\nNow you can use the logic you created in admin to determine the outcome of an event:\n\n```python\n## views.py\nfrom django.http import HttpResponse\nfrom conditions import eval_conditions\nfrom models import Campaign\n\ndef profile(request):\n for campaign in Campaign.objects.all():\n if eval_conditions(campaign, 'target', request.user):\n return HttpReponse(campaign.text)\n\n return HttpResponse(\"Nothing new to see.\")\n```\n\nUse django-conditions in your Django projects to change simple logic without having to re-deploy, and pass on the power to product managers and other non-engineers.\n\n## More Information\n\ndjango-conditions is under active development. You can follow my progress [on Trello](https://trello.com/b/XQnzHWYZ).\n\nFull documentation is available [on Read The Docs](http://django-conditions.readthedocs.org/).\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/RevolutionTech/django-conditions/", "keywords": "", "license": "ISC License", "maintainer": "", "maintainer_email": "", "name": "django-conditions", "package_url": "https://pypi.org/project/django-conditions/", "platform": "", "project_url": "https://pypi.org/project/django-conditions/", "project_urls": { "Homepage": "https://github.com/RevolutionTech/django-conditions/" }, "release_url": "https://pypi.org/project/django-conditions/0.9.15/", "requires_dist": [ "Django (>=1.11,<3.0a0)", "django-jsonfield (>=1.1.0,<2.0.0a0)" ], "requires_python": "", "summary": "A Django app that allows creation of conditional logic in admin.", "version": "0.9.15" }, "last_serial": 5108234, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "98d5b2029aafb1179aaacab564d5ed1a", "sha256": "73c0bd489bdb2b808642aa1aef8945d6f166d6d40747618688f4411f012a8629" }, "downloads": -1, "filename": "django-conditions-0.9.0.tar.gz", "has_sig": false, "md5_digest": "98d5b2029aafb1179aaacab564d5ed1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8981, "upload_time": "2014-12-16T03:51:14", "url": "https://files.pythonhosted.org/packages/4f/19/132a30fe1628b0a00bf3781ade02465149e285658450938537bb86acb044/django-conditions-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "a0aac9bc8e8c9a8fc61ae6e25518929a", "sha256": "bf37f0096a05f0bbcc1ad8ddb09b58c9abd3de8fcde1046568f9b54f3e7b467b" }, "downloads": -1, "filename": "django-conditions-0.9.1.tar.gz", "has_sig": false, "md5_digest": "a0aac9bc8e8c9a8fc61ae6e25518929a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10416, "upload_time": "2015-06-22T23:10:49", "url": "https://files.pythonhosted.org/packages/7f/31/985492a27780a34b5cfb23aa8957d3785f9e38c71b4efdb8817266a9fa01/django-conditions-0.9.1.tar.gz" } ], "0.9.10": [ { "comment_text": "", "digests": { "md5": "98c6dd9e26afdf932f63b60be9252deb", "sha256": "08431d43c47e79019f3333c455d49e8010f1b0ffe7611c0e889f44df665533bc" }, "downloads": -1, "filename": "django-conditions-0.9.10.tar.gz", "has_sig": false, "md5_digest": "98c6dd9e26afdf932f63b60be9252deb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15896, "upload_time": "2017-03-07T22:05:14", "url": "https://files.pythonhosted.org/packages/e9/3d/4de84f1d9bbef01832a54b489058ac7ccf91827117f77429d3e281e35de5/django-conditions-0.9.10.tar.gz" } ], "0.9.11": [ { "comment_text": "", "digests": { "md5": "a83804d38054bb37e8ab64c747c41326", "sha256": "82aa09572fd6154543fd96fad80aa09c2321fba91e7efb72e42fcdfaf6d8d76c" }, "downloads": -1, "filename": "django-conditions-0.9.11.tar.gz", "has_sig": false, "md5_digest": "a83804d38054bb37e8ab64c747c41326", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16416, "upload_time": "2017-06-27T05:57:30", "url": "https://files.pythonhosted.org/packages/0e/55/6281002902009cf389a9d100f49dd7f7c0519309e6681258921987ddb1c7/django-conditions-0.9.11.tar.gz" } ], "0.9.12": [ { "comment_text": "", "digests": { "md5": "2dc05606e1627f294cead874be45eea2", "sha256": "bcb4415e7c2233548aa1e0057086f93b30baab29d4bd7f9cfafd64a4b45c2b11" }, "downloads": -1, "filename": "django-conditions-0.9.12.tar.gz", "has_sig": false, "md5_digest": "2dc05606e1627f294cead874be45eea2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15898, "upload_time": "2017-11-28T22:47:12", "url": "https://files.pythonhosted.org/packages/65/ca/4ccf763c5406b6c336c225848721f8227bb5ce7d96595844ef9ad8199926/django-conditions-0.9.12.tar.gz" } ], "0.9.13": [ { "comment_text": "", "digests": { "md5": "43a642f080f02d21599dbd165b45b172", "sha256": "f6c4962b0227ed4086d47fb7bc6e7be5b1e7cf31b6052395e0376b29abe2cc53" }, "downloads": -1, "filename": "django-conditions-0.9.13.tar.gz", "has_sig": false, "md5_digest": "43a642f080f02d21599dbd165b45b172", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16420, "upload_time": "2017-12-12T07:44:51", "url": "https://files.pythonhosted.org/packages/71/44/8e9178a5be4608f726713b0d672faf21eccb315c3fbd3f8467dc988cc272/django-conditions-0.9.13.tar.gz" } ], "0.9.14.1": [ { "comment_text": "", "digests": { "md5": "b75c2de825edbb2abc3c5de1a736be06", "sha256": "775304f60f5b821adcbcf47dcfa537791609b95fe7203bc701d76d2282e7f9c1" }, "downloads": -1, "filename": "django-conditions-0.9.14.1.tar.gz", "has_sig": false, "md5_digest": "b75c2de825edbb2abc3c5de1a736be06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16582, "upload_time": "2018-03-09T02:40:15", "url": "https://files.pythonhosted.org/packages/d1/fb/c4be7462d13bb5a9caecb9c856e140d6dbc26c93d024c3e265e11405bb9d/django-conditions-0.9.14.1.tar.gz" } ], "0.9.15": [ { "comment_text": "", "digests": { "md5": "3a399804e39200aa16cff920fd9262e8", "sha256": "e05c3405d35afe55d52379b5ee1828a791e8c1fc353f0e5527385a4820c3b157" }, "downloads": -1, "filename": "django_conditions-0.9.15-py3-none-any.whl", "has_sig": false, "md5_digest": "3a399804e39200aa16cff920fd9262e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24468, "upload_time": "2019-04-06T20:24:31", "url": "https://files.pythonhosted.org/packages/0d/f9/8ceb7968c70d728424177d475285ec8aee2187561bc90455cb06156c758b/django_conditions-0.9.15-py3-none-any.whl" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "23e60a8042caffd2b0dbbf983940337e", "sha256": "f5b5b3b240148e9014e2b3095c3c402fdf7f86ecd25ecb0d184167478ac2d049" }, "downloads": -1, "filename": "django-conditions-0.9.2.tar.gz", "has_sig": false, "md5_digest": "23e60a8042caffd2b0dbbf983940337e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16048, "upload_time": "2015-06-22T23:43:44", "url": "https://files.pythonhosted.org/packages/ca/97/09f7d84a247b2ee22c9adcf911722aa505e0c179a2df6c4044cf02ab7772/django-conditions-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "62bd0dd90a7acc0d947575e2a352f966", "sha256": "6e8dc3d148b9cbcdbf4aa5471ea9b322a94477b956280e93234dd5b30954cde5" }, "downloads": -1, "filename": "django-conditions-0.9.3.tar.gz", "has_sig": false, "md5_digest": "62bd0dd90a7acc0d947575e2a352f966", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16095, "upload_time": "2015-06-25T16:38:31", "url": "https://files.pythonhosted.org/packages/d4/86/1e741c90dcee5e8287d73561bc7d6ab2bba6fbd031ec922bbdda588ef91b/django-conditions-0.9.3.tar.gz" } ], "0.9.4": [ { "comment_text": "", "digests": { "md5": "9dff225b05605bf6b61965d64022319a", "sha256": "ce8717fbb78363cd448d8fff70fcee26224dbd357ea558e4e1856a1a78eb6831" }, "downloads": -1, "filename": "django-conditions-0.9.4.tar.gz", "has_sig": false, "md5_digest": "9dff225b05605bf6b61965d64022319a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16110, "upload_time": "2015-06-25T17:14:48", "url": "https://files.pythonhosted.org/packages/50/e3/e081efb8145ed54c39a20545055874edc567d197850ce12bb46af2e9c2db/django-conditions-0.9.4.tar.gz" } ], "0.9.5": [ { "comment_text": "", "digests": { "md5": "6b78177c67dac7d9cc3566b1acc2b6ed", "sha256": "48e2067353101eff8236648a07ae188a3cc5c1efbbd5639c5c372925632829f6" }, "downloads": -1, "filename": "django-conditions-0.9.5.tar.gz", "has_sig": false, "md5_digest": "6b78177c67dac7d9cc3566b1acc2b6ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16278, "upload_time": "2015-10-08T08:01:40", "url": "https://files.pythonhosted.org/packages/0a/11/669591fd90c1fb50ea224cc383ef32acc4e0915d7ea6402dd5afe2b8d7d5/django-conditions-0.9.5.tar.gz" } ], "0.9.6": [ { "comment_text": "", "digests": { "md5": "c1d93237dd459ecda5162fd3ff321efe", "sha256": "2b45a651d81cf952c41697310df0daeb8f10335e73be11ebd8bfaf0ee69dc77a" }, "downloads": -1, "filename": "django-conditions-0.9.6.tar.gz", "has_sig": false, "md5_digest": "c1d93237dd459ecda5162fd3ff321efe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16358, "upload_time": "2016-09-16T07:13:45", "url": "https://files.pythonhosted.org/packages/07/0a/32e7a2b76c45fe008bab3cdb5bb7f01454c0699e7a74396c756d8b581167/django-conditions-0.9.6.tar.gz" } ], "0.9.7": [ { "comment_text": "", "digests": { "md5": "b5b6d961dad2fccdf71856058932b28d", "sha256": "22815c2107728a92b23fc5ae3b6513665907ffd3ceb2b41405849f8c40b56c8b" }, "downloads": -1, "filename": "django-conditions-0.9.7.tar.gz", "has_sig": false, "md5_digest": "b5b6d961dad2fccdf71856058932b28d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15859, "upload_time": "2016-09-30T19:00:26", "url": "https://files.pythonhosted.org/packages/64/61/9497a72f0db12d51eadbdd3ec9c4bcf979def0d30a3e08dd395917a58f25/django-conditions-0.9.7.tar.gz" } ], "0.9.8": [ { "comment_text": "", "digests": { "md5": "e50fe472592fe3d2d915e58164a6fec6", "sha256": "c9a6902fcaf56caca3f66d8cbea576aa04c9b8789dc4fc3c27ce7a192deacb1e" }, "downloads": -1, "filename": "django-conditions-0.9.8.tar.gz", "has_sig": false, "md5_digest": "e50fe472592fe3d2d915e58164a6fec6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15800, "upload_time": "2017-02-04T00:21:40", "url": "https://files.pythonhosted.org/packages/00/1e/ee8914ef6fe2f098830365737f117cdd46194af4a69866aace709d70422d/django-conditions-0.9.8.tar.gz" } ], "0.9.9": [ { "comment_text": "", "digests": { "md5": "f12996062f084d761f65f51697ced9e6", "sha256": "a018dd5340a150c05ad350128f6983c382ca03be00dc9060fbe5bac67e745986" }, "downloads": -1, "filename": "django-conditions-0.9.9.tar.gz", "has_sig": false, "md5_digest": "f12996062f084d761f65f51697ced9e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16325, "upload_time": "2017-02-13T00:40:26", "url": "https://files.pythonhosted.org/packages/ca/23/2d7201ced058cec3e47712fc7e29bcb936b383860a3064038bfb191caf47/django-conditions-0.9.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a399804e39200aa16cff920fd9262e8", "sha256": "e05c3405d35afe55d52379b5ee1828a791e8c1fc353f0e5527385a4820c3b157" }, "downloads": -1, "filename": "django_conditions-0.9.15-py3-none-any.whl", "has_sig": false, "md5_digest": "3a399804e39200aa16cff920fd9262e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24468, "upload_time": "2019-04-06T20:24:31", "url": "https://files.pythonhosted.org/packages/0d/f9/8ceb7968c70d728424177d475285ec8aee2187561bc90455cb06156c758b/django_conditions-0.9.15-py3-none-any.whl" } ] }