A choice field for Django using native Python Enums
Project description
A Django model field for native Python 3.4 Enums.
from enumchoicefield import ChoiceEnum, EnumChoiceField
class Fruit(ChoiceEnum):
apple = "Apple"
banana = "Banana"
orange = "Orange"
class Profile(models.Model):
name = models.CharField(max_length=100)
favourite_fruit = EnumChoiceField(Fruit, default=Fruit.banana)
Documentation
Testing
To run the tests:
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements-dev.txt
$ tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-enumchoicefield-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0366f02304637b537316c36a1e66912b3a5da29d6757b249d3dbb1fc5ea436fc |
|
MD5 | 21959aed29ce78978e0aa3d8a91e522d |
|
BLAKE2b-256 | 7b04823bae23db152be3f391ac25c08510d9f039d4b14cdc5005d49242ae9607 |