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
Built Distribution
Close
Hashes for django-enumchoicefield-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca8869331086e8b91e8c6a204e5310ac3c9f62e4c3b442231ef8e1fbfc93c48c |
|
MD5 | ed31702c2ed8f2d3a5e55ea20d93d74a |
|
BLAKE2b-256 | 7ea531f965533cd82610efecbc612e789b4fe7b3e0773b65b8b8bbea474f208d |
Close
Hashes for django_enumchoicefield-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4d7ec295fd38ae10ccea4809b36544aba6afa780f52a7561cb61f6dc4b4eb2 |
|
MD5 | f6e291c57fd138df30c87e9e074ddba0 |
|
BLAKE2b-256 | 8dc31d037fef00b42d04e5ef1679b0ed59a78dac6fc73dcb033f6cdccf43443f |