{ "info": { "author": "Pablo Recio", "author_email": "pablo@potatolondon.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "# Django Hashbrown\n\n[![build-status-image]][travis]\n\nYet another dead simple feature switching library for Django.\n\nSupports Django 1.8, 1.9 & 1.10.\n\n## Installation\n\nDjango Hashbrown is [hosted on PyPI](https://pypi.python.org/pypi/django-hashbrown) so\nyou can just install it using either:\n\n\n $ pip install django-hashbrown\n\nOr:\n\n\n $ easy_install django-hashbrown\n\nIf you prefer to use the development version of it, you can clone the repository\nand build it manually:\n\n $ git clone https://github.com/potatolondon/django-hashbrown.git\n $ cd django-hashbrown\n $ python setup.py install\n\n\n[build-status-image]: https://secure.travis-ci.org/potatolondon/django-hashbrown.png?branch=master\n[travis]: http://travis-ci.org/potatolondon/django-hashbrown?branch=master\n\n\n##\u00a0Usage\n\nThe main object to store feature switches data is `hashbrown.models.Switch`. This model has 4\nattributes:\n\n* `label` - Short name to identify each Switch\n* `description` - Longer description about what the switch is about\n* `globally_active` - Marks the tag as active all the time\n* `users` - M2M marking what users have the feature activated\n\n### Python\n\nThe simplest way to work with Hashbrown is to use `is_active` method:\n\n import hashbrown\n\n if hashbrown.is_active('things'):\n do_something()\n else:\n do_something_else()\n\nIf the given switch doesn't exist it'll be created disabled by default. This\nway `Switch` objects will never be on the database until code that checks it\ngets executed.\n\nHashbrown switches can be linked to different users so only those people have\naccess to certain feature:\n\n import hashbrown\n\n if hashbrown.is_active('things', user_object):\n do_something()\n else:\n do_something_else()\n\n### Django templates\n\nSame way, you can use the templatetag `ifswitch`:\n\n {% load hashbrown_tags %}\n\n {% ifswitch 'test' %}\n hello world!\n {% else %}\n things!\n {% endifswitch %}\n\nEven with the user:\n\n {% load hashbrown_tags %}\n\n {% ifswitch 'test' user %}\n hello world!\n {% else %}\n things!\n {% endifswitch %}\n\n## Configuration\n\nYou can prepare your switches before they get created in your settings,\nindicating that way either if it'll be enabled or disabled. You can add into\nyour `settings.py` something like:\n\n HASHBROWN_SWITCH_DEFAULTS = {\n 'test': {\n 'globally_active': True\n },\n 'things': {\n 'globally_active': False,\n 'description': 'This does some things'\n }\n }\n\nSo, when the switch \"test\" gets checked the first time, the switch will get\ncreated globally active, while \"things\" won't be active but it'll have a\ndescription.\n\n##\u00a0Testing\n\nAnother useful feature is the ability to mock switches in your tests, so\nyou can write tests for any case you are covering. It'll look something like:\n\n from hashbrown.testutils import switches\n\n @switches(my_flag=True)\n def test_things(self):\n # whatever you wanna test\n\n## Django management command\n\nDjango Hashbrown adds a 'switches' management command, which creates / deletes\nswitches defined in your HASHBROWN_SWITCH_DEFAULTS settings.\n\nTo create all switches listed in HASHBROWN_SWITCH_DEFAULTS:\n\n python manage.py switches\n\nAny existing switches already in the database will not be updated.\n\nTo create all switches and delete any switches *not* listed in\nHASHBROWN_SWITCH_DEFAULTS:\n\n python manage.py switches --delete\n\nYou will be prompted for confirmation before the switches are deleted. Use\n`--force` to delete the switches without confirmation.\n\n\n## Acknowledgements\n\nDjango Hashbrown is based and takes some pieces of code from Django Gargoyle\nhttps://github.com/disqus/gargoyle", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/potatolondon/django-hashbrown", "keywords": "django feature switching potato", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-hashbrown", "package_url": "https://pypi.org/project/django-hashbrown/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-hashbrown/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/potatolondon/django-hashbrown" }, "release_url": "https://pypi.org/project/django-hashbrown/0.7.0/", "requires_dist": null, "requires_python": null, "summary": "Yet another dead simple feature switching library for Django.", "version": "0.7.0" }, "last_serial": 2694385, "releases": { "0.6": [ { "comment_text": "", "digests": { "md5": "26d2027fb4596ace50d848c02f4d3aeb", "sha256": "a4d3c4b2d666f95998683ac75392a30886803e02d3fc26718e1fb866160f245b" }, "downloads": -1, "filename": "django-hashbrown-0.6.tar.gz", "has_sig": false, "md5_digest": "26d2027fb4596ace50d848c02f4d3aeb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8873, "upload_time": "2014-10-22T15:05:17", "url": "https://files.pythonhosted.org/packages/ac/ef/1dca10af418cf7dbd9a831f8b59136f8796bacde841073c026f34c26790d/django-hashbrown-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "03052609dd6aecc46193fdb678b48e01", "sha256": "c17f2a438bed2146d343738d79866b6b999385b448edc11a371fd2732eadbc0a" }, "downloads": -1, "filename": "django-hashbrown-0.6.1.tar.gz", "has_sig": false, "md5_digest": "03052609dd6aecc46193fdb678b48e01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8901, "upload_time": "2014-12-15T15:38:17", "url": "https://files.pythonhosted.org/packages/f5/cb/8a7f0bed273fe6d70862faf0f757fcb8b3ccc52c5119a15a723f9c6f1e4b/django-hashbrown-0.6.1.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "a62143cd7bc106f0ca3479406fac627c", "sha256": "2f9ec762db1f2dafe550882f82158201b6be3c4aa9053259aac59e7419dc25ea" }, "downloads": -1, "filename": "django-hashbrown-0.7.0.tar.gz", "has_sig": false, "md5_digest": "a62143cd7bc106f0ca3479406fac627c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8859, "upload_time": "2017-03-09T15:30:33", "url": "https://files.pythonhosted.org/packages/36/5b/a22f8580bdc82cc6c203ae670c7cfd7be1451e2b038693cb786a8f90146a/django-hashbrown-0.7.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a62143cd7bc106f0ca3479406fac627c", "sha256": "2f9ec762db1f2dafe550882f82158201b6be3c4aa9053259aac59e7419dc25ea" }, "downloads": -1, "filename": "django-hashbrown-0.7.0.tar.gz", "has_sig": false, "md5_digest": "a62143cd7bc106f0ca3479406fac627c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8859, "upload_time": "2017-03-09T15:30:33", "url": "https://files.pythonhosted.org/packages/36/5b/a22f8580bdc82cc6c203ae670c7cfd7be1451e2b038693cb786a8f90146a/django-hashbrown-0.7.0.tar.gz" } ] }