{ "info": { "author": "Simon Welker", "author_email": "simon@serioese.gmbh", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "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": "=====================\nSerious Django: Enums\n=====================\n\nhttps://github.com/serioeseGmbH/serious-django-enums\n\nserious-django-enums defines an Enum-like class, ``AutoEnum``, that intends to bring together the pattern\nto define choice fields that Django uses, and intuitive usage of Enums like most people know them.\n\nConsider the example where you've defined your choices on a ChoiceField, e.g.::\n\n class SomeForm(forms.Form):\n ...\n\tSTATE_CHOICES = (\n\t (\"ACTIVE\", \"active\"),\n\t (\"ENDED\", \"ended\"),\n\t)\n\tfield = forms.ChoiceField(choices=STATE_CHOICES, default=\"ACTIVE\")\n\nWhat this package gives you is wrapping this in a class and having it accessible as class attributes::\n\n class States(AutoEnum):\n choices = (\n (\"ACTIVE\", \"active\"),\n (\"ENDED\", \"ended\"),\n\t)\n\n class SomeForm(forms.Form):\n field = forms.ChoiceField(choices=States.choices, default=States.ACTIVE)\n\nwhich has the advantage of being import-able from different parts of your code and not directly tied to the form, and also gives you nice-looking property access instead of dictionary-like key access.\n\nThe definition is currently extremely basic, but has suited our needs well.\n\n\nQuick start\n-----------\n\n1. Install the package with pip::\n\n pip install serious-django-enums\n\n2. Import ``serious_django_enums.AutoEnum`` and subclass it, defining a ``choices`` property on the class.\n\n3. Use the auto-defined member properties of your AutoEnum-subclasses wherever you need them.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://serioese.gmbh/", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "serious-django-enums", "package_url": "https://pypi.org/project/serious-django-enums/", "platform": "", "project_url": "https://pypi.org/project/serious-django-enums/", "project_urls": { "Homepage": "https://serioese.gmbh/" }, "release_url": "https://pypi.org/project/serious-django-enums/0.1/", "requires_dist": null, "requires_python": "", "summary": "A Django extension to make `choices` on ChoiceFields more Enum-like.", "version": "0.1" }, "last_serial": 4628006, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "9197850c0980503a3329b79bd273e2c2", "sha256": "16c19645bd288b5bf4571dfb00abab26959c251b386f74abf2b2f8b6b3dc536f" }, "downloads": -1, "filename": "serious-django-enums-0.1.tar.gz", "has_sig": false, "md5_digest": "9197850c0980503a3329b79bd273e2c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3201, "upload_time": "2018-12-22T17:06:28", "url": "https://files.pythonhosted.org/packages/0f/28/6c241b65511b62e750a4d1b3614daea82bab210b1b90a058dac11bb83179/serious-django-enums-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9197850c0980503a3329b79bd273e2c2", "sha256": "16c19645bd288b5bf4571dfb00abab26959c251b386f74abf2b2f8b6b3dc536f" }, "downloads": -1, "filename": "serious-django-enums-0.1.tar.gz", "has_sig": false, "md5_digest": "9197850c0980503a3329b79bd273e2c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3201, "upload_time": "2018-12-22T17:06:28", "url": "https://files.pythonhosted.org/packages/0f/28/6c241b65511b62e750a4d1b3614daea82bab210b1b90a058dac11bb83179/serious-django-enums-0.1.tar.gz" } ] }