{ "info": { "author": "Tommy Wang", "author_email": "twang@joinem.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-choices-enum\n===================\n\ndjango-choices-enum allows the usage of the 2.x backport of Python 3.4's enum\npackage (enum34) as choices in Django models.\n\n from django.db import models\n from django_choices_enum import ChoicesEnum\n\n class Monster(models.Model):\n class Types(str, ChoicesEnum):\n BEAST = ('beast', 'Beast')\n UNDEAD = ('undead', 'Undead')\n HUMAN = ('human', 'Human')\n\n name = models.CharField(max_length=40)\n type = models.CharField(max_length=40, choices=Types.choices())\n\nYou may now write code like this:\n\n monsters = Monster.objects.filter(type=Monster.Types.BEAST)\n for m in monsters:\n assert m.type == Monster.Types.BEAST\n\n m = Monster(name='Vampire', type=Monster.Types.UNDEAD)\n m.save()\n\nDetails\n=======\n\nEach enumeration is a class subclassed from the type of the field and the\nChoicesEnum type:\n\n class MyIntEnumeration(int, ChoicesEnum):\n A = (1, 'Label A')\n\nEach constant is then assigned a tuple of (value, label) as expected by\nthe Django choices parameter. If the constant and label are the same,\nyou may omit the tuple and simply set the constant equal to the value of\nthe choice.\n\nContributions\n=============\n\nI did not really write most of this code. It was found and fixed from\na Gist:\n\nhttps://gist.github.com/dstufft/5600529", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/tcwang817/django-choices-enum/tarball/0.2", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/tcwang817/django-choices-enum", "keywords": "django choices enum", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-choices-enum", "package_url": "https://pypi.org/project/django-choices-enum/", "platform": "any", "project_url": "https://pypi.org/project/django-choices-enum/", "project_urls": { "Download": "https://github.com/tcwang817/django-choices-enum/tarball/0.2", "Homepage": "http://github.com/tcwang817/django-choices-enum" }, "release_url": "https://pypi.org/project/django-choices-enum/0.2/", "requires_dist": null, "requires_python": null, "summary": "make enum34 package play well with django choices", "version": "0.2" }, "last_serial": 1633437, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "3440312cdf4d4e43622e6c2810c4fe18", "sha256": "935e19419c5f13fdfe56ddf154db3a7129557764e29d623fe0846753bafe530b" }, "downloads": -1, "filename": "django-choices-enum-0.1.tar.gz", "has_sig": false, "md5_digest": "3440312cdf4d4e43622e6c2810c4fe18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3117, "upload_time": "2015-07-08T21:55:43", "url": "https://files.pythonhosted.org/packages/ae/20/d952d8e77e8ba7143b0c2c3d6f1cabd41ea820e541df2da40f9d8253c474/django-choices-enum-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "145383d1eceb52e44b0e892471c8d284", "sha256": "5ad88f4bdb03b2f7af4ab1352f37d4b63adb350965961de2d57c39d53ae0ab85" }, "downloads": -1, "filename": "django-choices-enum-0.2.tar.gz", "has_sig": false, "md5_digest": "145383d1eceb52e44b0e892471c8d284", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3841, "upload_time": "2015-07-14T20:40:06", "url": "https://files.pythonhosted.org/packages/58/5c/61f4a751fbc78424e97b93f69b8ccd92bb71077f15c23bf4709efba32833/django-choices-enum-0.2.tar.gz" } ], "0.2.dev1": [], "0.2.dev2": [ { "comment_text": "", "digests": { "md5": "41f85865e88a9d17fe4653903616ec3b", "sha256": "7b2109a95033844684423e362284bff471b36e0b8f36d99b24d8548d68a9361b" }, "downloads": -1, "filename": "django-choices-enum-0.2.dev2.tar.gz", "has_sig": false, "md5_digest": "41f85865e88a9d17fe4653903616ec3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3182, "upload_time": "2015-07-09T17:50:59", "url": "https://files.pythonhosted.org/packages/cd/15/40991a963f3112cb309a211d2d4927a83701f28a74c68226ed5020525cc7/django-choices-enum-0.2.dev2.tar.gz" } ], "0.2.dev4": [ { "comment_text": "", "digests": { "md5": "69258c59569b15e0bebfb09a16f62780", "sha256": "55927ed88c8c5b5a0f68368fd66cffc58a48f4725685a3731d2072a23b6a5f13" }, "downloads": -1, "filename": "django-choices-enum-0.2.dev4.tar.gz", "has_sig": false, "md5_digest": "69258c59569b15e0bebfb09a16f62780", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3894, "upload_time": "2015-07-09T19:29:42", "url": "https://files.pythonhosted.org/packages/4b/2f/4d6466f9287b5b15db7575ece2847a04708f7ec588be9818f541b4390d30/django-choices-enum-0.2.dev4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "145383d1eceb52e44b0e892471c8d284", "sha256": "5ad88f4bdb03b2f7af4ab1352f37d4b63adb350965961de2d57c39d53ae0ab85" }, "downloads": -1, "filename": "django-choices-enum-0.2.tar.gz", "has_sig": false, "md5_digest": "145383d1eceb52e44b0e892471c8d284", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3841, "upload_time": "2015-07-14T20:40:06", "url": "https://files.pythonhosted.org/packages/58/5c/61f4a751fbc78424e97b93f69b8ccd92bb71077f15c23bf4709efba32833/django-choices-enum-0.2.tar.gz" } ] }