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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4621364edf54b81e90b1c3461f1a9af8adefc56730ca1d15726456ef2ee2787f |
|
MD5 | 28321da40da26f2460398453df23b084 |
|
BLAKE2b-256 | 99f1cb345d27eab12885083cc479d18ff89b5d13e42546d675151631abb3728f |